commit ghc-blaze-markup for openSUSE:Factory
Hello community, here is the log from the commit of package ghc-blaze-markup for openSUSE:Factory checked in at 2015-05-21 08:11:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-blaze-markup (Old) and /work/SRC/openSUSE:Factory/.ghc-blaze-markup.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ghc-blaze-markup" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-blaze-markup/ghc-blaze-markup.changes 2014-11-26 20:55:29.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-blaze-markup.new/ghc-blaze-markup.changes 2015-05-21 08:12:00.000000000 +0200 @@ -1,0 +2,7 @@ +Mon Apr 20 09:09:40 UTC 2015 - mimi.vx@gmail.com + +- update to 0.7.0.2 +* Add combinators to insert HTML comments +* Add `Applicative` instance for `MarkupM` + +------------------------------------------------------------------- Old: ---- blaze-markup-0.6.1.1.tar.gz New: ---- blaze-markup-0.7.0.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-blaze-markup.spec ++++++ --- /var/tmp/diff_new_pack.j06rpu/_old 2015-05-21 08:12:01.000000000 +0200 +++ /var/tmp/diff_new_pack.j06rpu/_new 2015-05-21 08:12:01.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-blaze-markup # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,15 +18,17 @@ %global pkg_name blaze-markup -Name: ghc-blaze-markup -Version: 0.6.1.1 +%bcond_with tests + +Name: ghc-%{pkg_name} +Version: 0.7.0.2 Release: 0 Summary: A blazingly fast markup combinator library for Haskell License: BSD-3-Clause Group: System/Libraries -Url: http://hackage.haskell.org/package/%{pkg_name} -Source0: http://hackage.haskell.org/packages/archive/%{pkg_name}/%{version}/%{pkg_name}-%{version}.tar.gz +Url: https://hackage.haskell.org/package/%{pkg_name} +Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: ghc-Cabal-devel @@ -35,28 +37,32 @@ BuildRequires: ghc-blaze-builder-devel BuildRequires: ghc-bytestring-devel BuildRequires: ghc-text-devel +%if %{with tests} +BuildRequires: ghc-HUnit-devel +BuildRequires: ghc-QuickCheck-devel +BuildRequires: ghc-containers-devel +BuildRequires: ghc-test-framework-devel +BuildRequires: ghc-test-framework-hunit-devel +BuildRequires: ghc-test-framework-quickcheck2-devel +%endif # End cabal-rpm deps %description Core modules of a blazingly fast markup combinator library for the Haskell -programming language. The Text.Blaze module is a good -starting point, as well as this tutorial: -<http://jaspervdj.be/blaze/tutorial.html>. +programming language. The Text.Blaze module is a good starting point, as well +as this tutorial: <http://jaspervdj.be/blaze/tutorial.html>. %package devel Summary: Haskell %{pkg_name} library development files Group: Development/Libraries/Other -Requires: ghc-compiler -Requires(post): ghc-compiler -Requires(postun): ghc-compiler +Requires: ghc-compiler = %{ghc_version} +Requires(post): ghc-compiler = %{ghc_version} +Requires(postun): ghc-compiler = %{ghc_version} Requires: %{name} = %{version}-%{release} %description devel -Core modules of a blazingly fast markup combinator library for the Haskell -programming language. The Text.Blaze module is a good -starting point, as well as this tutorial: -<http://jaspervdj.be/blaze/tutorial.html>. +This package provides the Haskell %{pkg_name} library development files. %prep @@ -68,6 +74,11 @@ %install %ghc_lib_install +%check +%if %{with tests} +%cabal test +%endif + %post devel %ghc_pkg_recache ++++++ blaze-markup-0.6.1.1.tar.gz -> blaze-markup-0.7.0.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blaze-markup-0.6.1.1/CHANGELOG new/blaze-markup-0.7.0.2/CHANGELOG --- old/blaze-markup-0.6.1.1/CHANGELOG 2014-09-11 11:09:18.000000000 +0200 +++ new/blaze-markup-0.7.0.2/CHANGELOG 2015-03-23 10:57:17.000000000 +0100 @@ -1,3 +1,18 @@ +- 0.7.0.2 + * Relax `blaze-builder` dependency to allow 0.3 + +- 0.7.0.1 + * Bump `QuickCheck` dependency to allow 2.8 + +- 0.7.0.0 + * Depend on blaze-builder 0.4 + +- 0.6.3.0 + * Add combinators to insert HTML comments + +- 0.6.2.0 + * Add `Applicative` instance for `MarkupM` + - 0.6.1.1 * Bump `text` dependency to allow 1.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blaze-markup-0.6.1.1/blaze-markup.cabal new/blaze-markup-0.7.0.2/blaze-markup.cabal --- old/blaze-markup-0.6.1.1/blaze-markup.cabal 2014-09-11 11:09:18.000000000 +0200 +++ new/blaze-markup-0.7.0.2/blaze-markup.cabal 2015-03-23 10:57:17.000000000 +0100 @@ -1,5 +1,5 @@ Name: blaze-markup -Version: 0.6.1.1 +Version: 0.7.0.2 Homepage: http://jaspervdj.be/blaze Bug-Reports: http://github.com/jaspervdj/blaze-markup/issues License: BSD3 @@ -35,7 +35,7 @@ Build-depends: base >= 4 && < 5, - blaze-builder >= 0.2 && < 0.4, + blaze-builder >= 0.3 && < 0.5, text >= 0.10 && < 1.3, bytestring >= 0.9 && < 0.11 @@ -51,14 +51,14 @@ Build-depends: HUnit >= 1.2 && < 1.3, - QuickCheck >= 2.4 && < 2.8, + QuickCheck >= 2.4 && < 2.9, containers >= 0.3 && < 0.6, test-framework >= 0.4 && < 0.9, test-framework-hunit >= 0.3 && < 0.4, test-framework-quickcheck2 >= 0.3 && < 0.4, -- Copied from regular dependencies... base >= 4 && < 5, - blaze-builder >= 0.2 && < 0.4, + blaze-builder >= 0.3 && < 0.5, text >= 0.10 && < 1.3, bytestring >= 0.9 && < 0.11 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blaze-markup-0.6.1.1/src/Text/Blaze/Internal.hs new/blaze-markup-0.7.0.2/src/Text/Blaze/Internal.hs --- old/blaze-markup-0.6.1.1/src/Text/Blaze/Internal.hs 2014-09-11 11:09:18.000000000 +0200 +++ new/blaze-markup-0.7.0.2/src/Text/Blaze/Internal.hs 2015-03-23 10:57:17.000000000 +0100 @@ -36,6 +36,13 @@ , unsafeByteString , unsafeLazyByteString + -- * Comments + , textComment + , lazyTextComment + , stringComment + , unsafeByteStringComment + , unsafeLazyByteStringComment + -- * Converting values to tags. , textTag , stringTag @@ -64,6 +71,7 @@ ) where import Prelude hiding (null) +import Control.Applicative (Applicative (..)) import Data.Monoid (Monoid, mappend, mempty, mconcat) import Unsafe.Coerce (unsafeCoerce) import qualified Data.List as List @@ -136,6 +144,9 @@ | CustomLeaf ChoiceString Bool -- | HTML content | Content ChoiceString + -- | HTML comment. Note: you should wrap the 'ChoiceString' in a + -- 'PreEscaped'. + | Comment ChoiceString -- | Concatenation of two HTML pieces | forall b c. Append (MarkupM b) (MarkupM c) -- | Add an attribute to the inner HTML. Raw key, key, value, HTML to @@ -163,6 +174,16 @@ -- Safe because it does not contain a value anyway fmap _ = unsafeCoerce +instance Applicative MarkupM where + pure _ = Empty + {-# INLINE pure #-} + (<*>) = Append + {-# INLINE (<*>) #-} + (*>) = Append + {-# INLINE (*>) #-} + (<*) = Append + {-# INLINE (<*) #-} + instance Monad MarkupM where return _ = Empty {-# INLINE return #-} @@ -317,6 +338,37 @@ unsafeLazyByteString = mconcat . map unsafeByteString . BL.toChunks {-# INLINE unsafeLazyByteString #-} +-- | Create a comment from a 'Text' value. +-- The text should not contain @"--"@. +-- This is not checked by the library. +textComment :: Text -> Markup +textComment = Comment . PreEscaped . Text + +-- | Create a comment from a 'LT.Text' value. +-- The text should not contain @"--"@. +-- This is not checked by the library. +lazyTextComment :: LT.Text -> Markup +lazyTextComment = Comment . mconcat . map (PreEscaped . Text) . LT.toChunks + +-- | Create a comment from a 'String' value. +-- The text should not contain @"--"@. +-- This is not checked by the library. +stringComment :: String -> Markup +stringComment = Comment . PreEscaped . String + +-- | Create a comment from a 'ByteString' value. +-- The text should not contain @"--"@. +-- This is not checked by the library. +unsafeByteStringComment :: ByteString -> Markup +unsafeByteStringComment = Comment . PreEscaped . ByteString + +-- | Create a comment from a 'BL.ByteString' value. +-- The text should not contain @"--"@. +-- This is not checked by the library. +unsafeLazyByteStringComment :: BL.ByteString -> Markup +unsafeLazyByteStringComment = + Comment . mconcat . map (PreEscaped . ByteString) . BL.toChunks + -- | Create a 'Tag' from some 'Text'. -- textTag :: Text -- ^ Text to create a tag from @@ -478,6 +530,7 @@ Leaf _ _ _ -> False CustomLeaf _ _ -> False Content c -> emptyChoiceString c + Comment c -> emptyChoiceString c Append c1 c2 -> null c1 && null c2 AddAttribute _ _ _ c -> null c AddCustomAttribute _ _ c -> null c diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blaze-markup-0.6.1.1/src/Text/Blaze/Renderer/Pretty.hs new/blaze-markup-0.7.0.2/src/Text/Blaze/Renderer/Pretty.hs --- old/blaze-markup-0.6.1.1/src/Text/Blaze/Renderer/Pretty.hs 2014-09-11 11:09:18.000000000 +0200 +++ new/blaze-markup-0.7.0.2/src/Text/Blaze/Renderer/Pretty.hs 2015-03-23 10:57:17.000000000 +0100 @@ -34,6 +34,8 @@ (' ' : ) . fromChoiceString key . ("=\"" ++) . fromChoiceString value . ('"' :) . attrs go i _ (Content content) = ind i . fromChoiceString content . ('\n' :) + go i _ (Comment comment) = ind i . + ("<!-- " ++) . fromChoiceString comment . (" -->\n" ++) go i attrs (Append h1 h2) = go i attrs h1 . go i attrs h2 go _ _ Empty = id {-# NOINLINE go #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blaze-markup-0.6.1.1/src/Text/Blaze/Renderer/String.hs new/blaze-markup-0.7.0.2/src/Text/Blaze/Renderer/String.hs --- old/blaze-markup-0.6.1.1/src/Text/Blaze/Renderer/String.hs 2014-09-11 11:09:18.000000000 +0200 +++ new/blaze-markup-0.7.0.2/src/Text/Blaze/Renderer/String.hs 2015-03-23 10:57:17.000000000 +0100 @@ -59,7 +59,7 @@ renderString :: Markup -- ^ Markup to render -> String -- ^ String to append -> String -- ^ Resulting String -renderString = go id +renderString = go id where go :: (String -> String) -> MarkupM b -> String -> String go attrs (Parent _ open close content) = @@ -77,6 +77,8 @@ (' ' :) . fromChoiceString key . ("=\"" ++) . fromChoiceString value . ('"' :) . attrs go _ (Content content) = fromChoiceString content + go _ (Comment comment) = + ("<!-- " ++) . fromChoiceString comment . (" -->" ++) go attrs (Append h1 h2) = go attrs h1 . go attrs h2 go _ Empty = id {-# NOINLINE go #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blaze-markup-0.6.1.1/src/Text/Blaze/Renderer/Text.hs new/blaze-markup-0.7.0.2/src/Text/Blaze/Renderer/Text.hs --- old/blaze-markup-0.6.1.1/src/Text/Blaze/Renderer/Text.hs 2014-09-11 11:09:18.000000000 +0200 +++ new/blaze-markup-0.7.0.2/src/Text/Blaze/Renderer/Text.hs 2015-03-23 10:57:17.000000000 +0100 @@ -121,6 +121,10 @@ `mappend` B.singleton '"' `mappend` attrs) h go _ (Content content) = fromChoiceString d content + go _ (Comment comment) = + B.fromText "<!-- " + `mappend` fromChoiceString d comment + `mappend` " -->" go attrs (Append h1 h2) = go attrs h1 `mappend` go attrs h2 go _ Empty = mempty {-# NOINLINE go #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blaze-markup-0.6.1.1/src/Text/Blaze/Renderer/Utf8.hs new/blaze-markup-0.7.0.2/src/Text/Blaze/Renderer/Utf8.hs --- old/blaze-markup-0.6.1.1/src/Text/Blaze/Renderer/Utf8.hs 2014-09-11 11:09:18.000000000 +0200 +++ new/blaze-markup-0.7.0.2/src/Text/Blaze/Renderer/Utf8.hs 2015-03-23 10:57:17.000000000 +0100 @@ -87,6 +87,10 @@ `mappend` B.fromChar '"' `mappend` attrs) h go _ (Content content) = fromChoiceString content + go _ (Comment comment) = + B.fromByteString "<!-- " + `mappend` fromChoiceString comment + `mappend` B.fromByteString " -->" go attrs (Append h1 h2) = go attrs h1 `mappend` go attrs h2 go _ Empty = mempty {-# NOINLINE go #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blaze-markup-0.6.1.1/src/Text/Blaze.hs new/blaze-markup-0.7.0.2/src/Text/Blaze.hs --- old/blaze-markup-0.6.1.1/src/Text/Blaze.hs 2014-09-11 11:09:18.000000000 +0200 +++ new/blaze-markup-0.7.0.2/src/Text/Blaze.hs 2015-03-23 10:57:17.000000000 +0100 @@ -1,4 +1,6 @@ -{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeSynonymInstances #-} -- | BlazeMarkup is a markup combinator library. It provides a way to embed -- markup languages like HTML and SVG in Haskell in an efficient and convenient -- way, with a light-weight syntax. @@ -46,15 +48,34 @@ -- * Converting values to Markup. , ToMarkup (..) + , text + , preEscapedText + , lazyText + , preEscapedLazyText + , string + , preEscapedString , unsafeByteString , unsafeLazyByteString + -- * Comments + , textComment + , lazyTextComment + , stringComment + , unsafeByteStringComment + , unsafeLazyByteStringComment + -- * Creating tags. , textTag , stringTag -- * Converting values to attribute values. , ToValue (..) + , textValue + , preEscapedTextValue + , lazyTextValue + , preEscapedLazyTextValue + , stringValue + , preEscapedStringValue , unsafeByteStringValue , unsafeLazyByteStringValue @@ -66,14 +87,14 @@ , contents ) where -import Data.Monoid (mconcat) -import Data.Int (Int32, Int64) -import Data.Word (Word, Word32, Word64) +import Data.Int (Int32, Int64) +import Data.Monoid (mconcat) +import Data.Word (Word, Word32, Word64) -import Data.Text (Text) -import qualified Data.Text.Lazy as LT +import Data.Text (Text) +import qualified Data.Text.Lazy as LT -import Text.Blaze.Internal +import Text.Blaze.Internal -- | Class allowing us to use a single function for Markup values -- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blaze-markup-0.6.1.1/tests/Text/Blaze/Tests.hs new/blaze-markup-0.7.0.2/tests/Text/Blaze/Tests.hs --- old/blaze-markup-0.6.1.1/tests/Text/Blaze/Tests.hs 2014-09-11 11:09:18.000000000 +0200 +++ new/blaze-markup-0.7.0.2/tests/Text/Blaze/Tests.hs 2015-03-23 10:57:17.000000000 +0100 @@ -8,10 +8,11 @@ import Prelude hiding (div, id, null) import Data.Monoid (mempty, mappend) import Control.Monad (replicateM) -import Control.Applicative ((<$>)) +import Control.Applicative (Applicative (..), (<$>)) import Data.Word (Word8) -import Data.Char (ord) +import Data.Char (ord, isControl) import qualified Data.List as List +import qualified Prelude as Prelude import Test.Framework (Test) import Test.HUnit (Assertion, (@=?)) @@ -22,6 +23,7 @@ import qualified Data.ByteString.Lazy as LB import qualified Data.ByteString.Lazy.Char8 as LBC +import Text.Blaze import Text.Blaze.Internal import Text.Blaze.Tests.Util @@ -30,6 +32,7 @@ , testProperty "right identity Monoid law" monoidRightIdentity , testProperty "associativity Monoid law" monoidAssociativity , testProperty "mconcat Monoid law" monoidConcat + , testProperty "identity Applicative law" applicativeIdentity , testProperty "post escaping characters" postEscapingCharacters , testProperty "valid UTF-8" isValidUtf8 , testProperty "external </ sequence" externalEndSequence @@ -40,6 +43,7 @@ , testCase "contents 1" contents1 , testCase "empty 1" empty1 , testCase "empty 2" empty2 + , testCase "comment 1" comment1 ] -- | The left identity Monoid law. @@ -62,6 +66,11 @@ monoidConcat :: [Markup] -> Bool monoidConcat xs = sequence_ xs == foldr (>>) (return ()) xs +-- | Applicative identity law. +-- +applicativeIdentity :: Markup -> Bool +applicativeIdentity x = (pure Prelude.id <*> x) == x + -- | Escaped content cannot contain certain characters. -- postEscapingCharacters :: String -> Bool @@ -132,6 +141,7 @@ html :: Markup html = div $ do p ! id "para" $ "Hello " + stringComment "Test test" img ! name "An image" p "World!" @@ -150,6 +160,15 @@ html :: Markup html = "" `mappend` "" `mappend` p "a" +comment1 :: Assertion +comment1 = preEscapedString "<div>Hello <!-- Test --> World!</div>" @=? html + where + html :: Markup + html = div $ do + "Hello " + stringComment "Test" + " World!" + -- Show instance for the HTML type, so we can debug. -- instance Show Markup where @@ -206,11 +225,14 @@ -- Generate arbitrary string element. arbitraryString = do - s <- arbitrary + s <- genString return $ string s -- Generate an arbitrary HTML attribute. arbitraryAttribute = do attr <- elements [id, class_, name] - value <- arbitrary + value <- genString return $ attr $ stringValue value + + -- Don't use control characters + genString = filter (not . isControl) <$> arbitrary
participants (1)
-
root@hilbert.suse.de