Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge https://github.com/jaspervdj/blaze-html

  • Loading branch information...
commit 24a5e7a0937fd4e4111c415d4e8d2165d8966a1b 2 parents ccfa60c + 3d1c66b
@alevy alevy authored
View
28 .gitignore
@@ -25,17 +25,17 @@ website/_cache
website/docs
website/hakyll
-Text/Blaze/Html4/FrameSet.hs
-Text/Blaze/Html4/FrameSet/Attributes.hs
-Text/Blaze/Html4/Strict.hs
-Text/Blaze/Html4/Strict/Attributes.hs
-Text/Blaze/Html4/Transitional.hs
-Text/Blaze/Html4/Transitional/Attributes.hs
-Text/Blaze/Html5.hs
-Text/Blaze/Html5/Attributes.hs
-Text/Blaze/XHtml1/FrameSet.hs
-Text/Blaze/XHtml1/FrameSet/Attributes.hs
-Text/Blaze/XHtml1/Strict.hs
-Text/Blaze/XHtml1/Strict/Attributes.hs
-Text/Blaze/XHtml1/Transitional.hs
-Text/Blaze/XHtml1/Transitional/Attributes.hs
+src/Text/Blaze/Html4/FrameSet.hs
+src/Text/Blaze/Html4/FrameSet/Attributes.hs
+src/Text/Blaze/Html4/Strict.hs
+src/Text/Blaze/Html4/Strict/Attributes.hs
+src/Text/Blaze/Html4/Transitional.hs
+src/Text/Blaze/Html4/Transitional/Attributes.hs
+src/Text/Blaze/Html5.hs
+src/Text/Blaze/Html5/Attributes.hs
+src/Text/Blaze/XHtml1/FrameSet.hs
+src/Text/Blaze/XHtml1/FrameSet/Attributes.hs
+src/Text/Blaze/XHtml1/Strict.hs
+src/Text/Blaze/XHtml1/Strict/Attributes.hs
+src/Text/Blaze/XHtml1/Transitional.hs
+src/Text/Blaze/XHtml1/Transitional/Attributes.hs
View
5 .travis.yml
@@ -0,0 +1,5 @@
+language: haskell
+before_install:
+ - "make combinators"
+before_script:
+ - "cabal install HUnit QuickCheck test-framework test-framework-hunit test-framework-quickcheck2"
View
6 Makefile
@@ -4,7 +4,7 @@
GHC = ghc
GHCI = ghci
-GHC_FLAGS = -O2 -fforce-recomp -idoc/examples -ibenchmarks -itests
+GHC_FLAGS = -O2 -fforce-recomp -idoc/examples -ibenchmarks -isrc -itests
BENCHMARK_FLAGS = --resamples 10000
@@ -14,7 +14,7 @@ BENCHMARK_FLAGS = --resamples 10000
# Generate the actual HTML combinators
combinators:
- runghc Util/GenerateHtmlCombinators.hs
+ runghc -isrc src/Util/GenerateHtmlCombinators.hs
# Copy the docs the website directory
website-docs:
@@ -28,7 +28,7 @@ website-docs:
# Run the tests
test:
- $(GHC) $(GHC_FLAGS) -fhpc --make -main-is TestSuite tests/TestSuite.hs
+ $(GHC) $(GHC_FLAGS) -fhpc --make tests/TestSuite.hs
rm -f TestSuite.tix
./tests/TestSuite
View
5 blaze-from-html.cabal.blaze-from-html
@@ -15,8 +15,9 @@ Build-type: Simple
Cabal-version: >= 1.6
Executable blaze-from-html
- Ghc-Options: -Wall
- Main-Is: Util/BlazeFromHtml.hs
+ Ghc-Options: -Wall
+ Hs-source-dirs: src
+ Main-Is: Util/BlazeFromHtml.hs
Other-Modules:
Util.GenerateHtmlCombinators
View
46 blaze-html.cabal
@@ -1,5 +1,5 @@
Name: blaze-html
-Version: 0.4.3.1
+Version: 0.4.3.3
Homepage: http://jaspervdj.be/blaze
Bug-Reports: http://github.com/jaspervdj/blaze-html/issues
License: BSD3
@@ -15,15 +15,16 @@ Description:
starting point, as well as this tutorial:
<http://jaspervdj.be/blaze/tutorial.html>.
-Build-type: Simple
-Cabal-version: >=1.6
+Build-type: Simple
+Cabal-version: >= 1.8
Extra-source-files:
- Util/Sanitize.hs
- Util/GenerateHtmlCombinators.hs
+ src/Util/Sanitize.hs
+ src/Util/GenerateHtmlCombinators.hs
Library
- Ghc-Options: -Wall
+ Hs-source-dirs: src
+ Ghc-Options: -Wall
Exposed-modules:
Text.Blaze
@@ -48,10 +49,35 @@ Library
Text.Blaze.XHtml1.Transitional.Attributes
Build-depends:
- base >= 4 && < 5,
- blaze-builder >= 0.2 && < 0.4,
- text >= 0.10,
- bytestring >= 0.9
+ base >= 4 && < 5,
+ blaze-builder >= 0.2 && < 0.4,
+ text >= 0.10 && < 0.12,
+ bytestring >= 0.9 && < 0.10
+
+Test-suite blaze-html-tests
+ Type: exitcode-stdio-1.0
+ Hs-source-dirs: src tests
+ Main-is: TestSuite.hs
+ Ghc-options: -Wall
+
+ Other-modules:
+ Text.Blaze.Tests
+ Text.Blaze.Tests.Cases
+ Text.Blaze.Tests.Util
+ Util.Tests
+
+ Build-depends:
+ HUnit >= 1.2 && < 1.3,
+ QuickCheck >= 2.4 && < 2.5,
+ containers >= 0.3 && < 0.5,
+ test-framework >= 0.4 && < 0.7,
+ test-framework-hunit >= 0.2 && < 0.3,
+ test-framework-quickcheck2 >= 0.2 && < 0.3,
+ -- Copied from regular dependencies...
+ base >= 4 && < 5,
+ blaze-builder >= 0.2 && < 0.4,
+ text >= 0.10 && < 0.12,
+ bytestring >= 0.9 && < 0.10
Source-repository head
Type: git
View
0  Util/format-benchmarks.awk → script/format-benchmarks.awk
File renamed without changes
View
0  Util/get-tags.sh → script/get-tags.sh
File renamed without changes
View
0  Text/Blaze.hs → src/Text/Blaze.hs
File renamed without changes
View
4 Text/Blaze/Internal.hs → src/Text/Blaze/Internal.hs
@@ -172,6 +172,10 @@ newtype Tag = Tag { unTag :: StaticString }
--
newtype Attribute = Attribute (forall a. HtmlM a -> HtmlM a)
+instance Monoid Attribute where
+ mempty = Attribute id
+ Attribute f `mappend` Attribute g = Attribute (g . f)
+
-- | The type for the value part of an attribute.
--
newtype AttributeValue = AttributeValue { unAttributeValue :: ChoiceString }
View
0  Text/Blaze/Renderer/Pretty.hs → src/Text/Blaze/Renderer/Pretty.hs
File renamed without changes
View
0  Text/Blaze/Renderer/String.hs → src/Text/Blaze/Renderer/String.hs
File renamed without changes
View
0  Text/Blaze/Renderer/Text.hs → src/Text/Blaze/Renderer/Text.hs
File renamed without changes
View
0  Text/Blaze/Renderer/Utf8.hs → src/Text/Blaze/Renderer/Utf8.hs
File renamed without changes
View
0  Util/BlazeFromHtml.hs → src/Util/BlazeFromHtml.hs
File renamed without changes
View
2  Util/GenerateHtmlCombinators.hs → src/Util/GenerateHtmlCombinators.hs
@@ -106,7 +106,7 @@ writeHtmlVariant htmlVariant = do
, unlines (map makeAttribute sortedAttributes)
]
where
- basePath = "Text" </> "Blaze" </> foldl1 (</>) version'
+ basePath = "src" </> "Text" </> "Blaze" </> foldl1 (</>) version'
modulName = getModuleName htmlVariant
attributeModuleName = getAttributeModuleName htmlVariant
attributes' = attributes htmlVariant
View
0  Util/Sanitize.hs → src/Util/Sanitize.hs
File renamed without changes
View
2  tests/TestSuite.hs
@@ -1,6 +1,6 @@
-- | Main module to run all tests.
--
-module TestSuite where
+module Main where
import Test.Framework (defaultMain, testGroup)
View
1  tests/Text/Blaze/Tests.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE OverloadedStrings, TypeSynonymInstances, FlexibleInstances #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
module Text.Blaze.Tests
( tests
) where
View
7 tests/Text/Blaze/Tests/Cases.hs
@@ -7,7 +7,7 @@ module Text.Blaze.Tests.Cases
import Prelude hiding (div, id)
import Control.Monad (forM_)
-import Data.Monoid (mappend, mconcat)
+import Data.Monoid (mempty, mappend, mconcat)
import Data.Text (Text)
import Test.HUnit ((@=?))
@@ -89,6 +89,11 @@ tests = concatMap (uncurry makeTests) $ zip names
, HtmlTest "<p dojoType=\"select\">A paragraph</p>" $
p ! (customAttribute "dojoType" "select") $ "A paragraph"
+ , HtmlTest "<p>Hello</p>" $ p ! mempty $ "Hello"
+
+ , HtmlTest "<img src=\"foo.png\" alt=\"foo\">" $
+ img ! (src "foo.png" `mappend` alt "foo")
+
-- ToHtml/ToValue tests
, HtmlTest "12345678910" $ mconcat $ map toHtml [1 :: Int .. 10]
Please sign in to comment.
Something went wrong with that request. Please try again.