aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJohannes Gerer <oss@johannesgerer.com>2016-10-26 02:07:02 +0200
committerJohannes Gerer <oss@johannesgerer.com>2016-10-26 02:07:02 +0200
commit675085c2e0b0b851378da08b7d73024766107c87 (patch)
tree5a927de4a9576aef7e6129b96e74aa5c96f9ffb6
downloadblazeT-675085c2e0b0b851378da08b7d73024766107c87.tar.gz
blazeT-675085c2e0b0b851378da08b7d73024766107c87.tar.zst
blazeT-675085c2e0b0b851378da08b7d73024766107c87.zip
Initial
-rw-r--r--.gitignore21
-rw-r--r--.travis.yml182
-rw-r--r--LICENSE21
-rw-r--r--Makefile61
-rw-r--r--README.md87
-rw-r--r--Setup.hs13
-rw-r--r--blazeT.cabal100
-rw-r--r--src/BackwardsCompatibilty.hs29
-rw-r--r--src/Benchmarks/BenchmarkUtils.hs107
-rw-r--r--src/Benchmarks/BlazeTBenchmarks.hs133
-rw-r--r--src/Benchmarks/HtmlBenchmarks.hs132
-rw-r--r--src/Benchmarks/LICENSE30
-rw-r--r--src/Benchmarks/RunHtmlBenchmarks.hs36
-rw-r--r--src/Benchmarks/ServerChunkSize.hs52
-rw-r--r--src/Benchmarks/bigtable/erb.rb32
-rw-r--r--src/Benchmarks/bigtable/erubis.rb31
-rw-r--r--src/Benchmarks/bigtable/hamlet.hs33
-rw-r--r--src/Benchmarks/bigtable/html-minimalist.hs20
-rw-r--r--src/Benchmarks/bigtable/html.hs19
-rw-r--r--src/Benchmarks/bigtable/php.php30
-rw-r--r--src/Benchmarks/bigtable/xhtml.hs19
-rw-r--r--src/Text/BlazeT.hs81
-rw-r--r--src/Text/BlazeT/Html.hs22
-rw-r--r--src/Text/BlazeT/Html4/FrameSet.hs198
-rw-r--r--src/Text/BlazeT/Html4/FrameSet/Attributes.hs11
-rw-r--r--src/Text/BlazeT/Html4/Strict.hs172
-rw-r--r--src/Text/BlazeT/Html4/Strict/Attributes.hs11
-rw-r--r--src/Text/BlazeT/Html4/Transitional.hs194
-rw-r--r--src/Text/BlazeT/Html4/Transitional/Attributes.hs11
-rw-r--r--src/Text/BlazeT/Html5.hs234
-rw-r--r--src/Text/BlazeT/Html5/Attributes.hs11
-rw-r--r--src/Text/BlazeT/Internal.hs238
-rw-r--r--src/Text/BlazeT/Renderer/Pretty.hs22
-rw-r--r--src/Text/BlazeT/Renderer/String.hs27
-rw-r--r--src/Text/BlazeT/Renderer/Text.hs75
-rw-r--r--src/Text/BlazeT/Renderer/Utf8.hs66
-rw-r--r--src/Text/BlazeT/XHtml1/FrameSet.hs198
-rw-r--r--src/Text/BlazeT/XHtml1/FrameSet/Attributes.hs11
-rw-r--r--src/Text/BlazeT/XHtml1/Strict.hs172
-rw-r--r--src/Text/BlazeT/XHtml1/Strict/Attributes.hs11
-rw-r--r--src/Text/BlazeT/XHtml1/Transitional.hs194
-rw-r--r--src/Text/BlazeT/XHtml1/Transitional/Attributes.hs11
-rw-r--r--src/Text/BlazeT/XHtml5.hs234
-rw-r--r--src/Text/BlazeT/XHtml5/Attributes.hs11
-rw-r--r--src/Util/GenerateHtmlCombinators.hs519
-rwxr-xr-xsrc/Util/GenerateHtmlTCombinators.hs62
-rw-r--r--src/Util/Sanitize.hs112
47 files changed, 4096 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..da61294
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,21 @@
1dist
2dist-*
3cabal-dev
4*.o
5*.hi
6*.chi
7*.chs.h
8*.dyn_o
9*.dyn_hi
10.hpc
11.hsenv
12.cabal-sandbox/
13cabal.sandbox.config
14*.prof
15*.aux
16*.hp
17*.eventlog
18.stack-work/
19cabal.project.local
20report.html
21src/Benchmarks/RunHtmlBenchmarks
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..fbf2adb
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,182 @@
1# from https://docs.haskellstack.org/en/stable/GUIDE/#travis-with-caching
2
3# Use new container infrastructure to enable caching
4sudo: false
5
6# Choose a lightweight base image; we provide our own build tools.
7language: c
8
9# Caching so the next build will be fast too.
10cache:
11 directories:
12 - $HOME/.ghc
13 - $HOME/.cabal
14 - $HOME/.stack
15
16# The different configurations we want to test. We have BUILD=cabal which uses
17# cabal-install, and BUILD=stack which uses Stack. More documentation on each
18# of those below.
19#
20# We set the compiler values here to tell Travis to use a different
21# cache file per set of arguments.
22#
23# If you need to have different apt packages for each combination in the
24# matrix, you can use a line such as:
25# addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}}
26matrix:
27 include:
28 # We grab the appropriate GHC and cabal-install versions from hvr's PPA. See:
29 # https://github.com/hvr/multi-ghc-travis
30 #- env: BUILD=cabal GHCVER=7.0.4 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7
31 # compiler: ": #GHC 7.0.4"
32 # addons: {apt: {packages: [cabal-install-1.16,ghc-7.0.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
33 #- env: BUILD=cabal GHCVER=7.2.2 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7
34 # compiler: ": #GHC 7.2.2"
35 # addons: {apt: {packages: [cabal-install-1.16,ghc-7.2.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
36 #- env: BUILD=cabal GHCVER=7.4.2 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7
37 # compiler: ": #GHC 7.4.2"
38 # addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
39 - env: BUILD=cabal GHCVER=7.6.3 CABALVER=1.16 HAPPYVER=1.19.5 ALEXVER=3.1.7
40 compiler: ": #GHC 7.6.3"
41 addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
42 - env: BUILD=cabal GHCVER=7.8.4 CABALVER=1.18 HAPPYVER=1.19.5 ALEXVER=3.1.7
43 compiler: ": #GHC 7.8.4"
44 addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
45 - env: BUILD=cabal GHCVER=7.10.3 CABALVER=1.22 HAPPYVER=1.19.5 ALEXVER=3.1.7
46 compiler: ": #GHC 7.10.3"
47 addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
48 - env: BUILD=cabal GHCVER=8.0.1 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7
49 compiler: ": #GHC 8.0.1"
50 addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
51
52 # Build with the newest GHC and cabal-install. This is an accepted failure,
53 # see below.
54 - env: BUILD=cabal GHCVER=head CABALVER=head HAPPYVER=1.19.5 ALEXVER=3.1.7
55 compiler: ": #GHC HEAD"
56 addons: {apt: {packages: [cabal-install-head,ghc-head,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
57
58 # # The Stack builds. We can pass in arbitrary Stack arguments via the ARGS
59 # # variable, such as using --stack-yaml to point to a different file.
60 # - env: BUILD=stack ARGS=""
61 # compiler: ": #stack default"
62 # addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}}
63
64 # - env: BUILD=stack ARGS="--resolver lts-2"
65 # compiler: ": #stack 7.8.4"
66 # addons: {apt: {packages: [ghc-7.8.4], sources: [hvr-ghc]}}
67
68 # - env: BUILD=stack ARGS="--resolver lts-3"
69 # compiler: ": #stack 7.10.2"
70 # addons: {apt: {packages: [ghc-7.10.2], sources: [hvr-ghc]}}
71
72 # - env: BUILD=stack ARGS="--resolver lts-6"
73 # compiler: ": #stack 7.10.3"
74 # addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}}
75
76 # # Nightly builds are allowed to fail
77 # - env: BUILD=stack ARGS="--resolver nightly"
78 # compiler: ": #stack nightly"
79 # addons: {apt: {packages: [libgmp,libgmp-dev]}}
80
81 # # Build on OS X in addition to Linux
82 # - env: BUILD=stack ARGS=""
83 # compiler: ": #stack default osx"
84 # os: osx
85
86 # - env: BUILD=stack ARGS="--resolver lts-2"
87 # compiler: ": #stack 7.8.4 osx"
88 # os: osx
89
90 # - env: BUILD=stack ARGS="--resolver lts-3"
91 # compiler: ": #stack 7.10.2 osx"
92 # os: osx
93
94 # - env: BUILD=stack ARGS="--resolver lts-6"
95 # compiler: ": #stack 7.10.3 osx"
96 # os: osx
97
98 # - env: BUILD=stack ARGS="--resolver nightly"
99 # compiler: ": #stack nightly osx"
100 # os: osx
101
102 allow_failures:
103 - env: BUILD=cabal GHCVER=head CABALVER=head HAPPYVER=1.19.5 ALEXVER=3.1.7
104 # - env: BUILD=stack ARGS="--resolver nightly"
105
106before_install:
107# Using compiler above sets CC to an invalid value, so unset it
108- unset CC
109
110# We want to always allow newer versions of packages when building on GHC HEAD
111- CABALARGS=""
112- if [ "x$GHCVER" = "xhead" ]; then CABALARGS=--allow-newer; fi
113
114# Download and unpack the stack executable
115- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$HOME/.local/bin:/opt/alex/$ALEXVER/bin:/opt/happy/$HAPPYVER/bin:$HOME/.cabal/bin:$PATH
116- mkdir -p ~/.local/bin
117- |
118 if [ `uname` = "Darwin" ]
119 then
120 travis_retry curl --insecure -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin
121 else
122 travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
123 fi
124
125 # Use the more reliable S3 mirror of Hackage
126 mkdir -p $HOME/.cabal
127 echo 'remote-repo: hackage.haskell.org:http://hackage.fpcomplete.com/' > $HOME/.cabal/config
128 echo 'remote-repo-cache: $HOME/.cabal/packages' >> $HOME/.cabal/config
129
130 if [ "$CABALVER" != "1.16" ]
131 then
132 echo 'jobs: $ncpus' >> $HOME/.cabal/config
133 fi
134
135# Get the list of packages from the stack.yaml file
136- PACKAGES=$(stack --install-ghc query locals | grep '^ *path' | sed 's@^ *path:@@')
137
138install:
139- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
140- if [ -f configure.ac ]; then autoreconf -i; fi
141- |
142 set -ex
143 case "$BUILD" in
144 stack)
145 stack --no-terminal --install-ghc $ARGS test --bench --only-dependencies
146 ;;
147 cabal)
148 cabal --version
149 travis_retry cabal update
150 cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
151 ;;
152 esac
153 set +ex
154
155script:
156- |
157 set -ex
158 case "$BUILD" in
159 stack)
160 stack --no-terminal $ARGS test --bench --no-run-benchmarks --haddock --no-haddock-deps
161 ;;
162 cabal)
163 cabal install --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
164
165 ORIGDIR=$(pwd)
166 for dir in $PACKAGES
167 do
168 cd $dir
169 cabal check || [ "$CABALVER" == "1.16" ]
170 cabal sdist
171 PKGVER=$(cabal info . | awk '{print $2;exit}')
172 SRC_TGZ=$PKGVER.tar.gz
173 cd dist
174 tar zxfv "$SRC_TGZ"
175 cd "$PKGVER"
176 cabal configure --enable-tests
177 cabal build
178 cd $ORIGDIR
179 done
180 ;;
181 esac
182 set +ex
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..d45d10d
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
1MIT License
2
3Copyright (c) 2016 Johannes Gerer
4
5Permission is hereby granted, free of charge, to any person obtaining a copy
6of this software and associated documentation files (the "Software"), to deal
7in the Software without restriction, including without limitation the rights
8to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9copies of the Software, and to permit persons to whom the Software is
10furnished to do so, subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in all
13copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21SOFTWARE.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..04b0ff9
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,61 @@
1# Copyright Jasper Van der Jeugt 2010
2
3# All rights reserved.
4
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are met:
7
8# * Redistributions of source code must retain the above copyright
9# notice, this list of conditions and the following disclaimer.
10
11# * Redistributions in binary form must reproduce the above
12# copyright notice, this list of conditions and the following
13# disclaimer in the documentation and/or other materials provided
14# with the distribution.
15
16# * Neither the name of Jasper Van der Jeugt nor the names of other
17# contributors may be used to endorse or promote products derived
18# from this software without specific prior written permission.
19
20# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32################################################################################
33# Configuration
34################################################################################
35
36GHC = cabal exec -- ghc
37GHCI = ghci
38GHC_FLAGS = -O2 -fforce-recomp -ibenchmarks -isrc -itests -fsimpl-tick-factor=200
39
40BENCHMARK_FLAGS = --resamples 10000
41
42################################################################################
43# Benchmarks
44################################################################################
45
46benchmark:
47 $(GHC) $(GHC_FLAGS) --make -main-is Benchmarks.RunHtmlBenchmarks src/Benchmarks/RunHtmlBenchmarks.hs
48 ./src/Benchmarks/RunHtmlBenchmarks $(BENCHMARK_FLAGS) -o report.html
49
50benchmark-bigtable-non-haskell:
51 ruby benchmarks/bigtable/erb.rb
52 ruby benchmarks/bigtable/erubis.rb
53 php -n benchmarks/bigtable/php.php
54
55
56################################################################################
57# generate combinators
58################################################################################
59
60combinators:
61 runghc -isrc Util.GenerateHtmlTCombinators
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..0169fab
--- /dev/null
+++ b/README.md
@@ -0,0 +1,87 @@
1# blazeT [![Build Status](https://travis-ci.org/johannesgerer/blazeT.svg?branch=master)](https://travis-ci.org/johannesgerer/blazeT) [![Hackage](https://img.shields.io/hackage/v/blazeT.svg)](https://hackage.haskell.org/package/blazeT)
2
3A true monad (transformer) version of the
4[blaze-markup](https://hackage.haskell.org/package/blaze-markup) and
5[blaze-html](https://hackage.haskell.org/package/blaze-html)
6libraries.
7
8# Why?
9
10While blaze's `Markup` and `Html` types have `Monad` instances and can
11leverage the the concise `do` notation, they do not satisfy
12the
13[Monad Laws](https://hackage.haskell.org/package/base-4.8.0.0/docs/Control-Monad.html#t:Monad) and
14thus cannot be used as Monads, let alone Monad transformers.
15
16## Use Cases
17
18The `MarkupT` Monad Transformer enables us to write Markup (e.g. HTML)
19templates that have access to all those Monads you cannot live without
20anymore.
21
22Accessing an environment
23([MonadReader](https://hackage.haskell.org/package/mtl-2.2.1/docs/Control-Monad-Reader-Class.html)),
24accumulating log or other diagnostic output
25([MonadWriter](https://hackage.haskell.org/package/mtl-2.2.1/docs/Control-Monad-Writer-Class.html)),
26doing `IO` (like database access) are the first things that come to
27mind.
28
29The initial reason of existence of this library is its use
30in [Lykah](http://johannesgerer.com/Lykah), which powers my personal
31website
32[http://johannesgerer.com](http://johannesgerer.com/johannesgerer.com). In
33Lykah, the HTML templates have access to the whole site structure (to
34build things like menus) and automatically check, insert and keep
35track of referenced pages and assets, which turns out to be very
36useful for the task of static website generation.
37
38# How to use it?
39
40## Backwards compatible
41
42The library is intended to serve as a drop-in replacement for the
43`blaze-markup` and `blaze-html` libraries and should be backwards
44compatible:
45
46Simply replace your `module Text.Blaze.*` imports with `module
47Text.BlazeT.*` and it should give the same results.
48
49For usage of blaze check out
50their [documentation](https://jaspervdj.be/blaze/).
51
52## Unleash the monads
53
54
55
56# Implementation
57
58... is located
59in
60[Text.BlazeT.Internals](https://hackage.haskell.org/package/blazeT/docs/Text-BlazeT-Internals.html).
61
62Everything build around the simple `newtype` definition of the
63`MarkupT` transformer, which makes use of the fact that `Blaze.Markup`
64is
65a
66[Monoid](https://hackage.haskell.org/package/base-4.7.0.2/docs/Data-Monoid.html) and
67which is basically a `WriterT` transformer writing `Blaze.Markup`:
68
69```Haskell
70newtype MarkupT m a = MarkupT { fromMarkupT :: WriterT B.Markup m a }
71```
72
73Wrappers used to lift all `Blaze` entities into `BlazeT` are trivially
74expressible using basic `WriterT` class methods. Wrapping `Blaze.Markup` is simply `WriterT.tell`:
75
76```Haskell
77wrapMarkupT :: Monad m => B.Markup -> MarkupT m ()
78wrapMarkupT = tell
79```
80Wrapping functions that modify `Blaze.Markup` is simply `WriterT.censor`:
81
82```Haskell
83wrapMarkupT2 :: Monad m => (B.Markup -> B.Markup) -> MarkupT m a -> MarkupT m a
84wrapMarkupT2 = censor
85```
86
87
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
index 0000000..c67c506
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,13 @@
1import Distribution.Simple
2import Distribution.Simple.Setup
3import Distribution.Simple.Haddock
4main = do
5 defaultMainWithHooks simpleUserHooks{
6 haddockHook = \p l h f -> haddockHook simpleUserHooks p l h f{
7 haddockHoogle = Flag True,
8 haddockHtml = Flag True,
9 haddockExecutables = Flag True,
10 haddockHscolour = Flag True
11 }
12 }
13
diff --git a/blazeT.cabal b/blazeT.cabal
new file mode 100644
index 0000000..eb3907e
--- /dev/null
+++ b/blazeT.cabal
@@ -0,0 +1,100 @@
1Name: blazeT
2Version: 0.0.1
3Homepage:
4Bug-Reports: http://github.com/johannesgerer/blazeT/issues
5License: MIT
6License-file: LICENSE
7Author: Johannes Gerer
8Maintainer: Johannes Gerer <oss@johannesgerer.com>
9Homepage: http://johannesgerer.com/blazeT
10Stability: Experimental
11Category: Text, Data, Web
12Synopsis: A true monad (transformer) version of the blaze-markup and blaze-html libraries
13Tested-with: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1
14Description:
15 A true monad (transformer) version of the blaze-markup and blaze-html libraries, implemented as as a very thin wrapper around and strict superset of these libraries.
16 .
17 See <https://github.com/johannesgerer/blazeT Readme> on Github.
18
19
20
21Build-type: Custom
22Cabal-version: >= 1.8
23
24Extra-source-files:
25 README.md
26 src/Util/GenerateHtmlCombinators.hs
27 src/Util/Sanitize.hs
28 src/Util/GenerateHtmlTCombinators.hs
29
30Custom-setup
31 setup-depends: base >= 4.0.0.0 && < 5, Cabal
32
33Library
34 -- Default-Language: Haskell2010
35 Hs-source-dirs: src
36 Ghc-Options: -Wall
37 -fsimpl-tick-factor=200
38 -- -ddump-simpl-stats
39 -- -ddump-to-file
40 Exposed-modules:
41 Text.BlazeT
42 Text.BlazeT.Internal
43 Text.BlazeT.Html
44 Text.BlazeT.Renderer.Utf8
45 Text.BlazeT.Renderer.String
46 Text.BlazeT.Renderer.Pretty
47 Text.BlazeT.Renderer.Text
48 Text.BlazeT.Html4.FrameSet
49 Text.BlazeT.Html4.Strict
50 Text.BlazeT.Html4.Transitional
51 Text.BlazeT.Html5
52 Text.BlazeT.XHtml1.FrameSet
53 Text.BlazeT.XHtml1.Strict
54 Text.BlazeT.XHtml1.Transitional
55 Text.BlazeT.XHtml5
56 Text.BlazeT.Html4.FrameSet.Attributes
57 Text.BlazeT.Html4.Strict.Attributes
58 Text.BlazeT.Html4.Transitional.Attributes
59 Text.BlazeT.Html5.Attributes
60 Text.BlazeT.XHtml1.FrameSet.Attributes
61 Text.BlazeT.XHtml1.Strict.Attributes
62 Text.BlazeT.XHtml1.Transitional.Attributes
63 Text.BlazeT.XHtml5.Attributes
64
65 Build-depends:
66 base >= 4.0.0.0 && < 5
67 ,blaze-markup >= 0.6.0.0
68 ,blaze-html >= 0.6.0.0
69 ,blaze-builder >= 0.2
70 ,text
71 ,bytestring
72 ,mtl
73 ,transformers
74
75-- Test-suite blaze-markup-tests
76-- Type: exitcode-stdio-1.0
77-- Hs-source-dirs: src tests
78-- Main-is: TestSuite.hs
79-- Ghc-options: -Wall
80
81-- Other-modules:
82-- Text.Blaze.Tests
83-- Text.Blaze.Tests.Util
84
85-- Build-depends:
86-- HUnit >= 1.2 && < 1.3,
87-- QuickCheck >= 2.4 && < 2.8,
88-- containers >= 0.3 && < 0.6,
89-- test-framework >= 0.4 && < 0.9,
90-- test-framework-hunit >= 0.3 && < 0.4,
91-- test-framework-quickcheck2 >= 0.3 && < 0.4,
92-- -- Copied from regular dependencies...
93-- base >= 4 && < 5,
94-- blaze-builder >= 0.2 && < 0.4,
95-- text >= 0.10 && < 1.2,
96-- bytestring >= 0.9 && < 0.11
97
98Source-repository head
99 Type: git
100 Location: http://github.com/johannesgerer/blazeT \ No newline at end of file
diff --git a/src/BackwardsCompatibilty.hs b/src/BackwardsCompatibilty.hs
new file mode 100644
index 0000000..a8733ed
--- /dev/null
+++ b/src/BackwardsCompatibilty.hs
@@ -0,0 +1,29 @@
1{-# LANGUAGE OverloadedStrings #-}
2{-# LANGUAGE NoMonomorphismRestriction #-}
3{-# LANGUAGE RankNTypes #-}
4{-# LANGUAGE CPP #-}
5
6import Text.Blaze.Html5.Attributes
7#if 1
8import Text.BlazeT
9import Text.BlazeT.Html5 hiding (main)
10import Text.BlazeT.Renderer.Utf8
11#else
12import Text.Blaze
13import Text.Blaze.Html5 hiding (main)
14import Text.Blaze.Renderer.Utf8
15#endif
16
17main :: IO ()
18main = print $ renderMarkup $ do
19 docType
20 -- "some text" -- does not work
21 html $ do text "some text" -- does not work
22 br
23 ("wow" :: Markup) -- overloaded strings
24 text "asd" ! href "asd"
25 string "string" ! href "asd"
26 toMarkup ("more text" :: String)
27 html "wow"
28 html ! src "asd" $ br
29
diff --git a/src/Benchmarks/BenchmarkUtils.hs b/src/Benchmarks/BenchmarkUtils.hs
new file mode 100644
index 0000000..4b9546c
--- /dev/null
+++ b/src/Benchmarks/BenchmarkUtils.hs
@@ -0,0 +1,107 @@
1-- | This is a module which contains some ad-hoc HTML combinators for use when
2-- benchmarking
3--
4{-# LANGUAGE OverloadedStrings, NoMonomorphismRestriction #-}
5module Benchmarks.BenchmarkUtils
6 ( Html
7 , toHtml
8
9 , tr
10 , td
11 , html
12 , head
13 , title
14 , body
15 , div
16 , h1
17 , h2
18 , p
19 , ol
20 , li
21 , table
22 , img
23 , id
24 ) where
25
26import Prelude hiding (div, head, id)
27import Text.Blaze
28import Text.Blaze.Internal
29
30type Html = Markup
31
32toHtml :: ToMarkup a => a -> Html
33toHtml = toMarkup
34
35tr :: Html -- ^ Inner HTML.
36 -> Html -- ^ Resulting HTML.
37tr = Parent "tr" "<tr" "</tr>"
38{-# INLINE tr #-}
39
40td :: Html -- ^ Inner HTML.
41 -> Html -- ^ Resulting HTML.
42td = Parent "td" "<td" "</td>"
43{-# INLINE td #-}
44
45html :: Html -- ^ Inner HTML.
46 -> Html -- ^ Resulting HTML.
47html = Parent "html" "<html" "</html>"
48{-# INLINE html #-}
49
50head :: Html -- ^ Inner HTML.
51 -> Html -- ^ Resulting HTML.
52head = Parent "head" "<head" "</head>"
53{-# INLINE head #-}
54
55title :: Html -- ^ Inner HTML.
56 -> Html -- ^ Resulting HTML.
57title = Parent "title" "<title" "</title>"
58{-# INLINE title #-}
59
60body :: Html -- ^ Inner HTML.
61 -> Html -- ^ Resulting HTML.
62body = Parent "body" "<body" "</body>"
63{-# INLINE body #-}
64
65div :: Html -- ^ Inner HTML.
66 -> Html -- ^ Resulting HTML.
67div = Parent "div" "<div" "</div>"
68{-# INLINE div #-}
69
70h1 :: Html -- ^ Inner HTML.
71 -> Html -- ^ Resulting HTML.
72h1 = Parent "h1" "<h1" "</h1>"
73{-# INLINE h1 #-}
74
75h2 :: Html -- ^ Inner HTML.
76 -> Html -- ^ Resulting HTML.
77h2 = Parent "h2" "<h2" "</h2>"
78{-# INLINE h2 #-}
79
80p :: Html -- ^ Inner HTML.
81 -> Html -- ^ Resulting HTML.
82p = Parent "p" "<p" "</p>"
83{-# INLINE p #-}
84
85ol :: Html -- ^ Inner HTML.
86 -> Html -- ^ Resulting HTML.
87ol = Parent "ol" "<ol" "</ol>"
88{-# INLINE ol #-}
89
90li :: Html -- ^ Inner HTML.
91 -> Html -- ^ Resulting HTML.
92li = Parent "li" "<li" "</li>"
93{-# INLINE li #-}
94
95table :: Html -- ^ Inner HTML.
96 -> Html -- ^ Resulting HTML.
97table = Parent "table" "<table" "</table>"
98{-# INLINE table #-}
99
100img :: Html -- ^ Resulting HTML.
101img = Leaf "img" "<img" ">"
102{-# INLINE img #-}
103
104id :: AttributeValue -- ^ Attribute value.
105 -> Attribute -- ^ Resulting attribute.
106id = attribute "id" " id=\""
107{-# INLINE id #-}
diff --git a/src/Benchmarks/BlazeTBenchmarks.hs b/src/Benchmarks/BlazeTBenchmarks.hs
new file mode 100644
index 0000000..83a38ad
--- /dev/null
+++ b/src/Benchmarks/BlazeTBenchmarks.hs
@@ -0,0 +1,133 @@
1-- | This is a collection of HTML benchmarks for BlazeMarkup.
2--
3{-# LANGUAGE OverloadedStrings, ExistentialQuantification, RankNTypes #-}
4{-# OPTIONS_GHC -fno-warn-unused-do-bind #-}
5module Benchmarks.BlazeTBenchmarks where
6
7import Data.Monoid (Monoid, mempty, mconcat, mappend)
8import Prelude hiding (div, id,map)
9import qualified Prelude as P
10
11import Text.BlazeT
12import Text.BlazeT.Html5
13import qualified Text.BlazeT.Html5 as H
14import qualified Text.BlazeT.Html5.Attributes as A
15
16-- | Description of an HTML benchmark
17--
18data HtmlBenchmark = forall a. HtmlBenchmark
19 String -- ^ Name.
20 (a -> Html) -- ^ Rendering function.
21 a -- ^ Data.
22 Html -- ^ Longer description.
23
24-- | List containing all benchmarks.
25--
26benchmarks :: [HtmlBenchmark]
27benchmarks =
28 [ HtmlBenchmark "bigTable" bigTable bigTableData $
29 let h = toHtml $ length bigTableData
30 w = toHtml $ length $ P.head bigTableData
31 in (string "Rendering of a big (") >> h >> (string "x") >> w >> ") HTML table"
32 , HtmlBenchmark "basic" basic basicData
33 "A simple, small basic template with a few holes to fill in"
34 , HtmlBenchmark "wideTree" wideTree wideTreeData $
35 (string "A very wide tree (") >> toHtml (length wideTreeData) >> " elements)"
36 , HtmlBenchmark "wideTreeEscaping" wideTree wideTreeEscapingData $ do
37 (string "A very wide tree (") >> toHtml (length wideTreeData) >> (string " elements)")
38 " with lots of escaping"
39 , HtmlBenchmark "deepTree" deepTree deepTreeData $ do
40 (string "A really deep tree (") >> toHtml deepTreeData >> " nested templates)"
41 , HtmlBenchmark "manyAttributes" manyAttributes manyAttributesData $ do
42 (string "A single element with ") >> toHtml (length manyAttributesData)
43 " attributes."
44 , HtmlBenchmark "customAttribute" customAttributes customAttributesData $
45 "Creating custom attributes"
46 ]
47
48rows :: Int
49rows = 1000
50
51bigTableData :: [[Int]]
52bigTableData = replicate rows [1..10]
53{-# NOINLINE bigTableData #-}
54
55basicData :: (String, String, [String])
56basicData = ("Just a test", "joe", items)
57{-# NOINLINE basicData #-}
58
59items :: [String]
60items = fmap (("Number " `mappend`) . show) [1 :: Int .. 14]
61{-# NOINLINE items #-}
62
63wideTreeData :: [String]
64wideTreeData = take 5000 $
65 cycle ["λf.(λx.fxx)(λx.fxx)", "These old days", "Foobar", "lol", "x ∈ A"]
66{-# NOINLINE wideTreeData #-}
67
68wideTreeEscapingData :: [String]
69wideTreeEscapingData = take 1000 $
70 cycle ["<><>", "\"lol\"", "<&>", "'>>'"]
71{-# NOINLINE wideTreeEscapingData #-}
72
73deepTreeData :: Int
74deepTreeData = 1000
75{-# NOINLINE deepTreeData #-}
76
77manyAttributesData :: [String]
78manyAttributesData = wideTreeData
79
80customAttributesData :: [(String, String)]
81customAttributesData = zip wideTreeData wideTreeData
82
83-- | Render the argument matrix as an HTML table.
84--
85bigTable :: [[Int]] -- ^ Matrix.
86 -> Html -- ^ Result.
87bigTable t = table $ mconcat $ fmap row t
88 where
89 row r = tr $ mconcat $ fmap (td . toHtml) r
90
91-- | Render a simple HTML page with some data.
92--
93basic :: (String, String, [String]) -- ^ (Title, User, Items)
94 -> Html -- ^ Result.
95basic (title', user, items') = html $ do
96 H.head $ title $ toHtml title'
97 body $ do
98 div ! A.id "header" $ (h1 $ toHtml title')
99 p $ "Hello, " `mappend` toHtml user `mappend` "!"
100 p $ "Hello, me!"
101 p $ "Hello, world!"
102 h2 $ "loop"
103 ol $ mconcat $ fmap (li . toHtml) items'
104 div ! A.id "footer" $ mempty
105
106-- | A benchmark producing a very wide but very shallow tree.
107--
108wideTree :: [String] -- ^ Text to create a tree from.
109 -> Html -- ^ Result.
110wideTree = div . mapM_ ((p ! A.id "foo") . toHtml)
111
112-- | Create a very deep tree.
113--
114deepTree :: Int -- ^ Depth of the tree.
115 -> Html -- ^ Result.
116deepTree 0 = "foo"
117deepTree n = p $ table $ tr $ td $ div $ deepTree (n - 1)
118
119-- | Create an element with many attributes.
120--
121manyAttributes :: [String] -- ^ List of attribute values.
122 -> Html -- ^ Result.
123manyAttributes = foldl setAttribute img
124 where
125 setAttribute html' value' = html' ! A.id (toValue value')
126 {-# INLINE setAttribute #-}
127
128customAttributes :: [(String, String)] -- ^ List of attribute name, value pairs
129 -> Html -- ^ Result
130customAttributes = foldl setAttribute img
131 where
132 setAttribute html' (name, value') =
133 html' ! customAttribute (stringTag name) (toValue value')
diff --git a/src/Benchmarks/HtmlBenchmarks.hs b/src/Benchmarks/HtmlBenchmarks.hs
new file mode 100644
index 0000000..3070d52
--- /dev/null
+++ b/src/Benchmarks/HtmlBenchmarks.hs
@@ -0,0 +1,132 @@
1-- | This is a collection of HTML benchmarks for BlazeMarkup.
2--
3{-# LANGUAGE OverloadedStrings, ExistentialQuantification #-}
4{-# OPTIONS_GHC -fno-warn-unused-do-bind #-}
5module Benchmarks.HtmlBenchmarks where
6
7import Data.Monoid (Monoid, mempty, mconcat, mappend)
8import Prelude hiding (div, id)
9import qualified Prelude as P
10
11import Benchmarks.BenchmarkUtils
12import Text.Blaze
13import qualified Benchmarks.BenchmarkUtils as H
14
15-- | Description of an HTML benchmark
16--
17data HtmlBenchmark = forall a. HtmlBenchmark
18 { hName :: String -- ^ Name.
19 , hR :: (a -> Html) -- ^ Rendering function.
20 , hD :: a -- ^ Data.
21 , hH :: Html } -- ^ Longer description.
22
23-- | List containing all benchmarks.
24--
25benchmarks :: [HtmlBenchmark]
26benchmarks =
27 [ HtmlBenchmark "bigTable" bigTable bigTableData $
28 let h = toHtml $ length bigTableData
29 w = toHtml $ length $ P.head bigTableData
30 in "Rendering of a big (" >> h >> "x" >> w >> ") HTML table"
31 , HtmlBenchmark "basic" basic basicData
32 "A simple, small basic template with a few holes to fill in"
33 , HtmlBenchmark "wideTree" wideTree wideTreeData $
34 "A very wide tree (" >> toHtml (length wideTreeData) >> " elements)"
35 , HtmlBenchmark "wideTreeEscaping" wideTree wideTreeEscapingData $ do
36 "A very wide tree (" >> toHtml (length wideTreeData) >> " elements)"
37 " with lots of escaping"
38 , HtmlBenchmark "deepTree" deepTree deepTreeData $ do
39 "A really deep tree (" >> toHtml deepTreeData >> " nested templates)"
40 , HtmlBenchmark "manyAttributes" manyAttributes manyAttributesData $ do
41 "A single element with " >> toHtml (length manyAttributesData)
42 " attributes."
43 , HtmlBenchmark "customAttribute" customAttributes customAttributesData $
44 "Creating custom attributes"
45 ]
46
47rows :: Int
48rows = 1000
49
50bigTableData :: [[Int]]
51bigTableData = replicate rows [1..10]
52{-# NOINLINE bigTableData #-}
53
54basicData :: (String, String, [String])
55basicData = ("Just a test", "joe", items)
56{-# NOINLINE basicData #-}
57
58items :: [String]
59items = map (("Number " `mappend`) . show) [1 :: Int .. 14]
60{-# NOINLINE items #-}
61
62wideTreeData :: [String]
63wideTreeData = take 5000 $
64 cycle ["λf.(λx.fxx)(λx.fxx)", "These old days", "Foobar", "lol", "x ∈ A"]
65{-# NOINLINE wideTreeData #-}
66
67wideTreeEscapingData :: [String]
68wideTreeEscapingData = take 1000 $
69 cycle ["<><>", "\"lol\"", "<&>", "'>>'"]
70{-# NOINLINE wideTreeEscapingData #-}
71
72deepTreeData :: Int
73deepTreeData = 1000
74{-# NOINLINE deepTreeData #-}
75
76manyAttributesData :: [String]
77manyAttributesData = wideTreeData
78
79customAttributesData :: [(String, String)]
80customAttributesData = zip wideTreeData wideTreeData
81
82-- | Render the argument matrix as an HTML table.
83--
84bigTable :: [[Int]] -- ^ Matrix.
85 -> Html -- ^ Result.
86bigTable t = table $ mconcat $ map row t
87 where
88 row r = tr $ mconcat $ map (td . toHtml) r
89
90-- | Render a simple HTML page with some data.
91--
92basic :: (String, String, [String]) -- ^ (Title, User, Items)
93 -> Html -- ^ Result.
94basic (title', user, items') = html $ do
95 H.head $ title $ toHtml title'
96 body $ do
97 div ! id "header" $ (h1 $ toHtml title')
98 p $ "Hello, " `mappend` toHtml user `mappend` "!"
99 p $ "Hello, me!"
100 p $ "Hello, world!"
101 h2 $ "loop"
102 ol $ mconcat $ map (li . toHtml) items'
103 div ! id "footer" $ mempty
104
105-- | A benchmark producing a very wide but very shallow tree.
106--
107wideTree :: [String] -- ^ Text to create a tree from.
108 -> Html -- ^ Result.
109wideTree = div . mapM_ ((p ! id "foo") . toHtml)
110
111-- | Create a very deep tree.
112--
113deepTree :: Int -- ^ Depth of the tree.
114 -> Html -- ^ Result.
115deepTree 0 = "foo"
116deepTree n = p $ table $ tr $ td $ div $ deepTree (n - 1)
117
118-- | Create an element with many attributes.
119--
120manyAttributes :: [String] -- ^ List of attribute values.
121 -> Html -- ^ Result.
122manyAttributes = foldl setAttribute img
123 where
124 setAttribute html' value' = html' ! id (toValue value')
125 {-# INLINE setAttribute #-}
126
127customAttributes :: [(String, String)] -- ^ List of attribute name, value pairs
128 -> Html -- ^ Result
129customAttributes = foldl setAttribute img
130 where
131 setAttribute html' (name, value') =
132 html' ! customAttribute (stringTag name) (toValue value')
diff --git a/src/Benchmarks/LICENSE b/src/Benchmarks/LICENSE
new file mode 100644
index 0000000..8122505
--- /dev/null
+++ b/src/Benchmarks/LICENSE
@@ -0,0 +1,30 @@
1Copyright Jasper Van der Jeugt 2010
2
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are met:
7
8 * Redistributions of source code must retain the above copyright
9 notice, this list of conditions and the following disclaimer.
10
11 * Redistributions in binary form must reproduce the above
12 copyright notice, this list of conditions and the following
13 disclaimer in the documentation and/or other materials provided
14 with the distribution.
15
16 * Neither the name of Jasper Van der Jeugt nor the names of other
17 contributors may be used to endorse or promote products derived
18 from this software without specific prior written permission.
19
20THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/src/Benchmarks/RunHtmlBenchmarks.hs b/src/Benchmarks/RunHtmlBenchmarks.hs
new file mode 100644
index 0000000..04c28ff
--- /dev/null
+++ b/src/Benchmarks/RunHtmlBenchmarks.hs
@@ -0,0 +1,36 @@
1-- | This is a module which runs the 'HtmlBenchmarks' module using the different
2-- renderers available.
3--
4module Benchmarks.RunHtmlBenchmarks where
5
6import Criterion.Main
7import qualified Data.Text.Lazy as LT
8import Data.List
9import qualified Data.ByteString.Lazy as LB
10
11import qualified Text.Blaze.Renderer.Utf8 as Utf8
12import qualified Text.Blaze.Renderer.String as String
13import qualified Text.Blaze.Renderer.Text as Text
14
15import Benchmarks.HtmlBenchmarks (HtmlBenchmark (..), benchmarks)
16import qualified Benchmarks.BlazeTBenchmarks as BT (HtmlBenchmark (..), benchmarks)
17import qualified Text.BlazeT.Renderer.Utf8 as TUtf8
18import qualified Text.BlazeT.Renderer.String as TString
19import qualified Text.BlazeT.Renderer.Text as TText
20
21-- | Function to run the benchmarks using criterion
22--
23main :: IO ()
24main = defaultMain $ zipWith g benchmarks BT.benchmarks
25 where
26 g x y = bgroup (hName x) $ benchHtml x ++ benchHtml2 y
27 benchHtml (HtmlBenchmark _ f x _) =
28 [ bench "Utf8" $ nf (LB.length . Utf8.renderMarkup . f) x
29 , bench "String" $ nf (String.renderMarkup . f) x
30 , bench "Text" $ nf (LT.length . Text.renderMarkup . f) x
31 ]
32 benchHtml2 (BT.HtmlBenchmark _ f x _) =
33 [ bench "BlazeT.Utf8" $ nf (LB.length . TUtf8.renderMarkup . f) x
34 , bench "BlazeT.String" $ nf (TString.renderMarkup . f) x
35 , bench "BlazeT.Text" $ nf (LT.length . TText.renderMarkup . f) x
36 ]
diff --git a/src/Benchmarks/ServerChunkSize.hs b/src/Benchmarks/ServerChunkSize.hs
new file mode 100644
index 0000000..7b01c68
--- /dev/null
+++ b/src/Benchmarks/ServerChunkSize.hs
@@ -0,0 +1,52 @@
1-- | A benchmark for measuring the impact of lazy bytestring chunk size on
2-- server performance.
3--
4{-# LANGUAGE OverloadedStrings #-}
5module Main where
6
7import Control.Concurrent (forkIO)
8import Control.Monad (forever)
9import Data.Monoid (mappend)
10import Network (listenOn, PortID (PortNumber))
11import Network.Socket (accept, sClose)
12import Prelude hiding (putStrLn)
13import System.Environment (getArgs)
14
15import Network.Socket.ByteString (recv, send)
16import Network.Socket.ByteString.Lazy (sendAll)
17import qualified Data.ByteString.Char8 as SBC
18import qualified Data.ByteString.Lazy as LB
19
20-- | Generate a 128k response, with a given chunk size.
21--
22makeResponse :: Int -- ^ Chunk size.
23 -> LB.ByteString -- ^ Result.
24makeResponse chunkSize =
25 let chunks = createChunks chunkSize totalSize
26 in LB.fromChunks chunks
27 where
28 -- A 64 kilobyte response.
29 totalSize = 128 * 1024
30
31 createChunks c s
32 | c < s = SBC.replicate c 'a' : createChunks c (s - c)
33 | otherwise = SBC.replicate s 'a' : []
34
35main :: IO ()
36main = do
37 args <- getArgs
38 let port = PortNumber $ fromIntegral $ (read $ head args :: Int)
39 chunkSize = read $ args !! 1
40
41 socket <- listenOn port
42 forever $ do
43 (s, _) <- accept socket
44 forkIO (respond chunkSize s)
45 where
46 respond chunkSize s = do
47 _ <- recv s 1024
48 _ <- send s $ "HTTP/1.1 200 OK\r\n"
49 `mappend` "Content-Type: text/html; charset=UTF-8\r\n"
50 `mappend` "\r\n"
51 sendAll s $ makeResponse chunkSize
52 sClose s
diff --git a/src/Benchmarks/bigtable/erb.rb b/src/Benchmarks/bigtable/erb.rb
new file mode 100644
index 0000000..c3a675a
--- /dev/null
+++ b/src/Benchmarks/bigtable/erb.rb
@@ -0,0 +1,32 @@
1# BigTable benchmark implemented in ERB.
2#
3require 'erb'
4require 'benchmark'
5include ERB::Util
6
7table = (1 .. 1000).map do |_| (1 .. 10) end
8
9template = ERB.new <<-EOF
10<table>
11 <% table.each do |row| %>
12 <tr>
13 <% row.each do |value| %>
14 <td>
15 <%= value %>
16 </td>
17 <% end %>
18 </tr>
19 <% end %>
20</table>
21EOF
22
23number_runs = 100
24start_time = Time.now.to_f
25number_runs.times do
26 template.result(binding)
27end
28end_time = Time.now.to_f
29
30# start_time and end_time are both in seconds now
31ms = (end_time - start_time) * 1000 / number_runs
32puts "\"ERB\", #{ms}"
diff --git a/src/Benchmarks/bigtable/erubis.rb b/src/Benchmarks/bigtable/erubis.rb
new file mode 100644
index 0000000..9a1edf9
--- /dev/null
+++ b/src/Benchmarks/bigtable/erubis.rb
@@ -0,0 +1,31 @@
1# BigTable benchmark implemented in erubis
2#
3require 'erubis'
4require 'benchmark'
5
6table = (1 .. 1000).map do |_| (1 .. 10) end
7
8template = Erubis::Eruby.new <<-EOF
9<table>
10 <% table.each do |row| %>
11 <tr>
12 <% row.each do |value| %>
13 <td>
14 <%= value %>
15 </td>
16 <% end %>
17 </tr>
18 <% end %>
19</table>
20EOF
21
22number_runs = 100
23start_time = Time.now.to_f
24number_runs.times do
25 template.result(binding)
26end
27end_time = Time.now.to_f
28
29# start_time and end_time are both in seconds now
30ms = (end_time - start_time) * 1000 / number_runs
31puts "\"Erubis\", #{ms}"
diff --git a/src/Benchmarks/bigtable/hamlet.hs b/src/Benchmarks/bigtable/hamlet.hs
new file mode 100644
index 0000000..2778f2d
--- /dev/null
+++ b/src/Benchmarks/bigtable/hamlet.hs
@@ -0,0 +1,33 @@
1-- | BigTable benchmark implemented using Hamlet.
2--
3{-# LANGUAGE QuasiQuotes #-}
4module Main where
5
6import Criterion.Main
7import Text.Hamlet
8import Text.Hamlet.Monad
9import Numeric (showInt)
10import Data.Text (Text)
11import qualified Data.Text as T
12import Data.Maybe (fromJust)
13
14main = defaultMain
15 [ bench "bigTable" $ nf bigTable bigTableData
16 ]
17 where
18 rows :: Int
19 rows = 1000
20
21 bigTableData :: [[Int]]
22 bigTableData = replicate rows [1..10]
23 {-# NOINLINE bigTableData #-}
24
25bigTable rows = fromJust $ hamletToText undefined [$hamlet|
26%table
27 $forall rows row
28 %tr
29 $forall row cell
30 %td $showInt'.cell$
31|]
32 where
33 showInt' i = Encoded $ T.pack $ showInt i ""
diff --git a/src/Benchmarks/bigtable/html-minimalist.hs b/src/Benchmarks/bigtable/html-minimalist.hs
new file mode 100644
index 0000000..2a52751
--- /dev/null
+++ b/src/Benchmarks/bigtable/html-minimalist.hs
@@ -0,0 +1,20 @@
1-- | BigTable benchmark using the html-minimalist package from hackage.
2--
3import Text.HTML.Light hiding (map)
4import Criterion.Main
5
6bigTable :: [[Int]] -> String
7bigTable t =
8 renderXHTML xhtml_1_0_strict $ html [] $ return $ table [] $ map row t
9 where
10 row r = tr [] $ map (td [] . return . cdata . show) r
11
12main = defaultMain
13 [ bench "bigTable" $ nf bigTable myTable ]
14 where
15 rows :: Int
16 rows = 1000
17
18 myTable :: [[Int]]
19 myTable = replicate rows [1..10]
20 {-# NOINLINE myTable #-}
diff --git a/src/Benchmarks/bigtable/html.hs b/src/Benchmarks/bigtable/html.hs
new file mode 100644
index 0000000..57a62b3
--- /dev/null
+++ b/src/Benchmarks/bigtable/html.hs
@@ -0,0 +1,19 @@
1-- | BigTable benchmark using the HTML package from hackage.
2--
3import Text.Html
4import Criterion.Main
5
6bigTable :: [[Int]] -> String
7bigTable t = renderHtml $ table $ concatHtml $ map row t
8 where
9 row r = tr $ concatHtml $ map (td . stringToHtml . show) r
10
11main = defaultMain
12 [ bench "bigTable" $ nf bigTable myTable ]
13 where
14 rows :: Int
15 rows = 1000
16
17 myTable :: [[Int]]
18 myTable = replicate rows [1..10]
19 {-# NOINLINE myTable #-}
diff --git a/src/Benchmarks/bigtable/php.php b/src/Benchmarks/bigtable/php.php
new file mode 100644
index 0000000..f2e51a4
--- /dev/null
+++ b/src/Benchmarks/bigtable/php.php
@@ -0,0 +1,30 @@
1<?php
2$table = array_fill(0, 1000, array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
3
4function test_bigtable($table) {
5 ob_start();
6?>
7<table>
8<?php foreach($table as $row) { ?>
9<tr>
10<?php foreach($row as $value) { ?>
11<td><?php echo $value; ?></td>
12<?php } ?>
13</tr>
14<?php } ?>
15</table>
16<?php
17 return ob_get_clean();
18}
19
20$request_count = 1000;
21
22$start = microtime(true);
23for ($i = 0; $i < $request_count; $i++)
24{
25 test_bigtable($table);
26}
27$elapsed = microtime(true) - $start;
28$time_per_request = ($elapsed / $request_count) * 1000;
29echo "\"PHP\", $time_per_request\n";
30?>
diff --git a/src/Benchmarks/bigtable/xhtml.hs b/src/Benchmarks/bigtable/xhtml.hs
new file mode 100644
index 0000000..993994c
--- /dev/null
+++ b/src/Benchmarks/bigtable/xhtml.hs
@@ -0,0 +1,19 @@
1-- | BigTable benchmark using the XHTML package from hackage.
2--
3import Text.XHtml.Strict
4import Criterion.Main
5
6bigTable :: [[Int]] -> String
7bigTable t = renderHtml $ table $ concatHtml $ map row t
8 where
9 row r = tr $ concatHtml $ map (td . stringToHtml . show) r
10
11main = defaultMain
12 [ bench "bigTable" $ nf bigTable myTable ]
13 where
14 rows :: Int
15 rows = 1000
16
17 myTable :: [[Int]]
18 myTable = replicate rows [1..10]
19 {-# NOINLINE myTable #-}
diff --git a/src/Text/BlazeT.hs b/src/Text/BlazeT.hs
new file mode 100644
index 0000000..27228fa
--- /dev/null
+++ b/src/Text/BlazeT.hs
@@ -0,0 +1,81 @@
1{-# LANGUAGE UndecidableInstances #-}
2{-# LANGUAGE FlexibleInstances #-}
3{-# LANGUAGE RankNTypes #-}
4module Text.BlazeT
5 (
6 -- * Important types.
7 Markup
8 , Tag
9 , Attribute
10 , AttributeValue
11
12 -- * Creating attributes.
13 , dataAttribute
14 , customAttribute
15
16 -- * Converting values to Markup.
17 , ToMarkup (..)
18 , text
19 , preEscapedText
20 , lazyText
21 , preEscapedLazyText
22 , string
23 , preEscapedString
24 , unsafeByteString
25 , unsafeLazyByteString
26
27 -- * Comments
28 , textComment
29 , lazyTextComment
30 , stringComment
31 , unsafeByteStringComment
32 , unsafeLazyByteStringComment
33
34 -- * Creating tags.
35 , textTag
36 , stringTag
37
38 -- * Converting values to attribute values.
39 , B.ToValue (..)
40 , textValue
41 , preEscapedTextValue
42 , lazyTextValue
43 , preEscapedLazyTextValue
44 , stringValue
45 , preEscapedStringValue
46 , unsafeByteStringValue
47 , unsafeLazyByteStringValue
48
49 -- * Setting attributes
50 , (!)
51 , (!?)
52
53 -- * Modifiying Markup trees
54 , contents
55
56 -- * BlazeT new stuff
57 ,MarkupM
58 ,Markup2
59 ,mapMarkupT
60 ,MarkupT
61 ,runMarkup
62 ,runMarkupT
63 ,execMarkup
64 ,execMarkupT
65 ) where
66
67import qualified Text.Blaze as B
68import Text.BlazeT.Internal
69
70class ToMarkup a where
71 toMarkup :: a -> Markup
72 preEscapedToMarkup :: a -> Markup
73
74-- test :: (ToMarkup a, Monad m) => a -> MarkupT m ()
75-- test = toMarkup
76
77instance B.ToMarkup a => ToMarkup a where
78 toMarkup = wrapMarkup . B.toMarkup
79 {-# INLINE toMarkup #-}
80 preEscapedToMarkup = wrapMarkup . B.preEscapedToMarkup
81 {-# INLINE preEscapedToMarkup #-}
diff --git a/src/Text/BlazeT/Html.hs b/src/Text/BlazeT/Html.hs
new file mode 100644
index 0000000..4a21c03
--- /dev/null
+++ b/src/Text/BlazeT/Html.hs
@@ -0,0 +1,22 @@
1{-# LANGUAGE RankNTypes #-}
2module Text.BlazeT.Html
3 ( module Text.BlazeT
4 , Html
5 , toHtml
6 , preEscapedToHtml
7 -- * BlazeT new stuff
8 ,HtmlM
9 ,HtmlT
10 ) where
11
12import Text.BlazeT
13
14type HtmlT = MarkupT
15type HtmlM = MarkupM
16type Html = Markup
17
18toHtml ::(ToMarkup a) => a -> Html
19toHtml = toMarkup
20
21preEscapedToHtml ::(ToMarkup a) => a -> Html
22preEscapedToHtml = preEscapedToMarkup
diff --git a/src/Text/BlazeT/Html4/FrameSet.hs b/src/Text/BlazeT/Html4/FrameSet.hs
new file mode 100644
index 0000000..5d6ec03
--- /dev/null
+++ b/src/Text/BlazeT/Html4/FrameSet.hs
@@ -0,0 +1,198 @@
1-- !! DO NOT EDIT
2{-|
3(Automatically generated by @src\/Util\/GenerateHtmlTCombinators.hs:49@)
4
5This module wraps all exports of "Text.Blaze.Html4.FrameSet" using 'wrapMarkup' and 'wrapMarkup'.
6-}
7module Text.BlazeT.Html4.FrameSet
8 (module Text.BlazeT.Html4.FrameSet
9 ,module Text.BlazeT.Html
10 ) where
11import qualified Text.Blaze.Html4.FrameSet
12import Text.BlazeT
13import Text.BlazeT.Html
14import Text.BlazeT.Internal
15
16docTypeHtml :: Markup2
17docTypeHtml = wrapMarkup2 Text.Blaze.Html4.FrameSet.docTypeHtml
18a :: Markup2
19a = wrapMarkup2 Text.Blaze.Html4.FrameSet.a
20abbr :: Markup2
21abbr = wrapMarkup2 Text.Blaze.Html4.FrameSet.abbr
22acronym :: Markup2
23acronym = wrapMarkup2 Text.Blaze.Html4.FrameSet.acronym
24address :: Markup2
25address = wrapMarkup2 Text.Blaze.Html4.FrameSet.address
26b :: Markup2
27b = wrapMarkup2 Text.Blaze.Html4.FrameSet.b
28bdo :: Markup2
29bdo = wrapMarkup2 Text.Blaze.Html4.FrameSet.bdo
30big :: Markup2
31big = wrapMarkup2 Text.Blaze.Html4.FrameSet.big
32blockquote :: Markup2
33blockquote = wrapMarkup2 Text.Blaze.Html4.FrameSet.blockquote
34body :: Markup2
35body = wrapMarkup2 Text.Blaze.Html4.FrameSet.body
36button :: Markup2
37button = wrapMarkup2 Text.Blaze.Html4.FrameSet.button
38caption :: Markup2
39caption = wrapMarkup2 Text.Blaze.Html4.FrameSet.caption
40cite :: Markup2
41cite = wrapMarkup2 Text.Blaze.Html4.FrameSet.cite
42code :: Markup2
43code = wrapMarkup2 Text.Blaze.Html4.FrameSet.code
44colgroup :: Markup2
45colgroup = wrapMarkup2 Text.Blaze.Html4.FrameSet.colgroup
46dd :: Markup2
47dd = wrapMarkup2 Text.Blaze.Html4.FrameSet.dd
48del :: Markup2
49del = wrapMarkup2 Text.Blaze.Html4.FrameSet.del
50dfn :: Markup2
51dfn = wrapMarkup2 Text.Blaze.Html4.FrameSet.dfn
52div :: Markup2
53div = wrapMarkup2 Text.Blaze.Html4.FrameSet.div
54dl :: Markup2
55dl = wrapMarkup2 Text.Blaze.Html4.FrameSet.dl
56dt :: Markup2
57dt = wrapMarkup2 Text.Blaze.Html4.FrameSet.dt
58em :: Markup2
59em = wrapMarkup2 Text.Blaze.Html4.FrameSet.em
60fieldset :: Markup2
61fieldset = wrapMarkup2 Text.Blaze.Html4.FrameSet.fieldset
62form :: Markup2
63form = wrapMarkup2 Text.Blaze.Html4.FrameSet.form
64h1 :: Markup2
65h1 = wrapMarkup2 Text.Blaze.Html4.FrameSet.h1
66h2 :: Markup2
67h2 = wrapMarkup2 Text.Blaze.Html4.FrameSet.h2
68h3 :: Markup2
69h3 = wrapMarkup2 Text.Blaze.Html4.FrameSet.h3
70h4 :: Markup2
71h4 = wrapMarkup2 Text.Blaze.Html4.FrameSet.h4
72h5 :: Markup2
73h5 = wrapMarkup2 Text.Blaze.Html4.FrameSet.h5
74h6 :: Markup2
75h6 = wrapMarkup2 Text.Blaze.Html4.FrameSet.h6
76head :: Markup2
77head = wrapMarkup2 Text.Blaze.Html4.FrameSet.head
78html :: Markup2
79html = wrapMarkup2 Text.Blaze.Html4.FrameSet.html
80i :: Markup2
81i = wrapMarkup2 Text.Blaze.Html4.FrameSet.i
82ins :: Markup2
83ins = wrapMarkup2 Text.Blaze.Html4.FrameSet.ins
84kbd :: Markup2
85kbd = wrapMarkup2 Text.Blaze.Html4.FrameSet.kbd
86label :: Markup2
87label = wrapMarkup2 Text.Blaze.Html4.FrameSet.label
88legend :: Markup2
89legend = wrapMarkup2 Text.Blaze.Html4.FrameSet.legend
90li :: Markup2
91li = wrapMarkup2 Text.Blaze.Html4.FrameSet.li
92map :: Markup2
93map = wrapMarkup2 Text.Blaze.Html4.FrameSet.map
94noscript :: Markup2
95noscript = wrapMarkup2 Text.Blaze.Html4.FrameSet.noscript
96object :: Markup2
97object = wrapMarkup2 Text.Blaze.Html4.FrameSet.object
98ol :: Markup2
99ol = wrapMarkup2 Text.Blaze.Html4.FrameSet.ol
100optgroup :: Markup2
101optgroup = wrapMarkup2 Text.Blaze.Html4.FrameSet.optgroup
102option :: Markup2
103option = wrapMarkup2 Text.Blaze.Html4.FrameSet.option
104p :: Markup2
105p = wrapMarkup2 Text.Blaze.Html4.FrameSet.p
106pre :: Markup2
107pre = wrapMarkup2 Text.Blaze.Html4.FrameSet.pre
108q :: Markup2
109q = wrapMarkup2 Text.Blaze.Html4.FrameSet.q
110samp :: Markup2
111samp = wrapMarkup2 Text.Blaze.Html4.FrameSet.samp
112script :: Markup2
113script = wrapMarkup2 Text.Blaze.Html4.FrameSet.script
114select :: Markup2
115select = wrapMarkup2 Text.Blaze.Html4.FrameSet.select
116small :: Markup2
117small = wrapMarkup2 Text.Blaze.Html4.FrameSet.small
118span :: Markup2
119span = wrapMarkup2 Text.Blaze.Html4.FrameSet.span
120strong :: Markup2
121strong = wrapMarkup2 Text.Blaze.Html4.FrameSet.strong
122style :: Markup2
123style = wrapMarkup2 Text.Blaze.Html4.FrameSet.style
124sub :: Markup2
125sub = wrapMarkup2 Text.Blaze.Html4.FrameSet.sub
126sup :: Markup2
127sup = wrapMarkup2 Text.Blaze.Html4.FrameSet.sup
128table :: Markup2
129table = wrapMarkup2 Text.Blaze.Html4.FrameSet.table
130tbody :: Markup2
131tbody = wrapMarkup2 Text.Blaze.Html4.FrameSet.tbody
132td :: Markup2
133td = wrapMarkup2 Text.Blaze.Html4.FrameSet.td
134textarea :: Markup2
135textarea = wrapMarkup2 Text.Blaze.Html4.FrameSet.textarea
136tfoot :: Markup2
137tfoot = wrapMarkup2 Text.Blaze.Html4.FrameSet.tfoot
138th :: Markup2
139th = wrapMarkup2 Text.Blaze.Html4.FrameSet.th
140thead :: Markup2
141thead = wrapMarkup2 Text.Blaze.Html4.FrameSet.thead
142title :: Markup2
143title = wrapMarkup2 Text.Blaze.Html4.FrameSet.title
144tr :: Markup2
145tr = wrapMarkup2 Text.Blaze.Html4.FrameSet.tr
146tt :: Markup2
147tt = wrapMarkup2 Text.Blaze.Html4.FrameSet.tt
148ul :: Markup2
149ul = wrapMarkup2 Text.Blaze.Html4.FrameSet.ul
150var :: Markup2
151var = wrapMarkup2 Text.Blaze.Html4.FrameSet.var
152applet :: Markup2
153applet = wrapMarkup2 Text.Blaze.Html4.FrameSet.applet
154center :: Markup2
155center = wrapMarkup2 Text.Blaze.Html4.FrameSet.center
156dir :: Markup2
157dir = wrapMarkup2 Text.Blaze.Html4.FrameSet.dir
158font :: Markup2
159font = wrapMarkup2 Text.Blaze.Html4.FrameSet.font
160iframe :: Markup2
161iframe = wrapMarkup2 Text.Blaze.Html4.FrameSet.iframe
162isindex :: Markup2
163isindex = wrapMarkup2 Text.Blaze.Html4.FrameSet.isindex
164menu :: Markup2
165menu = wrapMarkup2 Text.Blaze.Html4.FrameSet.menu
166noframes :: Markup2
167noframes = wrapMarkup2 Text.Blaze.Html4.FrameSet.noframes
168s :: Markup2
169s = wrapMarkup2 Text.Blaze.Html4.FrameSet.s
170u :: Markup2
171u = wrapMarkup2 Text.Blaze.Html4.FrameSet.u
172frameset :: Markup2
173frameset = wrapMarkup2 Text.Blaze.Html4.FrameSet.frameset
174docType :: Markup
175docType = wrapMarkup Text.Blaze.Html4.FrameSet.docType
176area :: Markup
177area = wrapMarkup Text.Blaze.Html4.FrameSet.area
178br :: Markup
179br = wrapMarkup Text.Blaze.Html4.FrameSet.br
180col :: Markup
181col = wrapMarkup Text.Blaze.Html4.FrameSet.col
182hr :: Markup
183hr = wrapMarkup Text.Blaze.Html4.FrameSet.hr
184link :: Markup
185link = wrapMarkup Text.Blaze.Html4.FrameSet.link
186img :: Markup
187img = wrapMarkup Text.Blaze.Html4.FrameSet.img
188input :: Markup
189input = wrapMarkup Text.Blaze.Html4.FrameSet.input
190meta :: Markup
191meta = wrapMarkup Text.Blaze.Html4.FrameSet.meta
192param :: Markup
193param = wrapMarkup Text.Blaze.Html4.FrameSet.param
194basefont :: Markup
195basefont = wrapMarkup Text.Blaze.Html4.FrameSet.basefont
196frame :: Markup
197frame = wrapMarkup Text.Blaze.Html4.FrameSet.frame
198
diff --git a/src/Text/BlazeT/Html4/FrameSet/Attributes.hs b/src/Text/BlazeT/Html4/FrameSet/Attributes.hs
new file mode 100644
index 0000000..d806f29
--- /dev/null
+++ b/src/Text/BlazeT/Html4/FrameSet/Attributes.hs
@@ -0,0 +1,11 @@
1-- !! DO NOT EDIT
2{-|
3(Automatically generated by @src\/Util\/GenerateHtmlTCombinators.hs:49@)
4
5This module simply reexports the corresponding @blaze-html@ module.
6-}
7module Text.BlazeT.Html4.FrameSet.Attributes
8 (module Text.Blaze.Html4.FrameSet.Attributes
9 ) where
10import Text.Blaze.Html4.FrameSet.Attributes
11
diff --git a/src/Text/BlazeT/Html4/Strict.hs b/src/Text/BlazeT/Html4/Strict.hs
new file mode 100644
index 0000000..90fd65a
--- /dev/null
+++ b/src/Text/BlazeT/Html4/Strict.hs
@@ -0,0 +1,172 @@
1-- !! DO NOT EDIT
2{-|
3(Automatically generated by @src\/Util\/GenerateHtmlTCombinators.hs:49@)
4
5This module wraps all exports of "Text.Blaze.Html4.Strict" using 'wrapMarkup' and 'wrapMarkup'.
6-}
7module Text.BlazeT.Html4.Strict
8 (module Text.BlazeT.Html4.Strict
9 ,module Text.BlazeT.Html
10 ) where
11import qualified Text.Blaze.Html4.Strict
12import Text.BlazeT
13import Text.BlazeT.Html
14import Text.BlazeT.Internal
15
16docTypeHtml :: Markup2
17docTypeHtml = wrapMarkup2 Text.Blaze.Html4.Strict.docTypeHtml
18a :: Markup2
19a = wrapMarkup2 Text.Blaze.Html4.Strict.a
20abbr :: Markup2
21abbr = wrapMarkup2 Text.Blaze.Html4.Strict.abbr
22acronym :: Markup2
23acronym = wrapMarkup2 Text.Blaze.Html4.Strict.acronym
24address :: Markup2
25address = wrapMarkup2 Text.Blaze.Html4.Strict.address
26b :: Markup2
27b = wrapMarkup2 Text.Blaze.Html4.Strict.b
28bdo :: Markup2
29bdo = wrapMarkup2 Text.Blaze.Html4.Strict.bdo
30big :: Markup2
31big = wrapMarkup2 Text.Blaze.Html4.Strict.big
32blockquote :: Markup2
33blockquote = wrapMarkup2 Text.Blaze.Html4.Strict.blockquote
34body :: Markup2
35body = wrapMarkup2 Text.Blaze.Html4.Strict.body
36button :: Markup2
37button = wrapMarkup2 Text.Blaze.Html4.Strict.button
38caption :: Markup2
39caption = wrapMarkup2 Text.Blaze.Html4.Strict.caption
40cite :: Markup2
41cite = wrapMarkup2 Text.Blaze.Html4.Strict.cite
42code :: Markup2
43code = wrapMarkup2 Text.Blaze.Html4.Strict.code
44colgroup :: Markup2
45colgroup = wrapMarkup2 Text.Blaze.Html4.Strict.colgroup
46dd :: Markup2
47dd = wrapMarkup2 Text.Blaze.Html4.Strict.dd
48del :: Markup2
49del = wrapMarkup2 Text.Blaze.Html4.Strict.del
50dfn :: Markup2
51dfn = wrapMarkup2 Text.Blaze.Html4.Strict.dfn
52div :: Markup2
53div = wrapMarkup2 Text.Blaze.Html4.Strict.div
54dl :: Markup2
55dl = wrapMarkup2 Text.Blaze.Html4.Strict.dl
56dt :: Markup2
57dt = wrapMarkup2 Text.Blaze.Html4.Strict.dt
58em :: Markup2
59em = wrapMarkup2 Text.Blaze.Html4.Strict.em
60fieldset :: Markup2
61fieldset = wrapMarkup2 Text.Blaze.Html4.Strict.fieldset
62form :: Markup2
63form = wrapMarkup2 Text.Blaze.Html4.Strict.form
64h1 :: Markup2
65h1 = wrapMarkup2 Text.Blaze.Html4.Strict.h1
66h2 :: Markup2
67h2 = wrapMarkup2 Text.Blaze.Html4.Strict.h2
68h3 :: Markup2
69h3 = wrapMarkup2 Text.Blaze.Html4.Strict.h3
70h4 :: Markup2
71h4 = wrapMarkup2 Text.Blaze.Html4.Strict.h4
72h5 :: Markup2
73h5 = wrapMarkup2 Text.Blaze.Html4.Strict.h5
74h6 :: Markup2
75h6 = wrapMarkup2 Text.Blaze.Html4.Strict.h6
76head :: Markup2
77head = wrapMarkup2 Text.Blaze.Html4.Strict.head
78html :: Markup2
79html = wrapMarkup2 Text.Blaze.Html4.Strict.html
80i :: Markup2
81i = wrapMarkup2 Text.Blaze.Html4.Strict.i
82ins :: Markup2
83ins = wrapMarkup2 Text.Blaze.Html4.Strict.ins
84kbd :: Markup2
85kbd = wrapMarkup2 Text.Blaze.Html4.Strict.kbd
86label :: Markup2
87label = wrapMarkup2 Text.Blaze.Html4.Strict.label
88legend :: Markup2
89legend = wrapMarkup2 Text.Blaze.Html4.Strict.legend
90li :: Markup2
91li = wrapMarkup2 Text.Blaze.Html4.Strict.li
92map :: Markup2
93map = wrapMarkup2 Text.Blaze.Html4.Strict.map
94noscript :: Markup2
95noscript = wrapMarkup2 Text.Blaze.Html4.Strict.noscript
96object :: Markup2
97object = wrapMarkup2 Text.Blaze.Html4.Strict.object
98ol :: Markup2
99ol = wrapMarkup2 Text.Blaze.Html4.Strict.ol
100optgroup :: Markup2
101optgroup = wrapMarkup2 Text.Blaze.Html4.Strict.optgroup
102option :: Markup2
103option = wrapMarkup2 Text.Blaze.Html4.Strict.option
104p :: Markup2
105p = wrapMarkup2 Text.Blaze.Html4.Strict.p
106pre :: Markup2
107pre = wrapMarkup2 Text.Blaze.Html4.Strict.pre
108q :: Markup2
109q = wrapMarkup2 Text.Blaze.Html4.Strict.q
110samp :: Markup2
111samp = wrapMarkup2 Text.Blaze.Html4.Strict.samp
112script :: Markup2
113script = wrapMarkup2 Text.Blaze.Html4.Strict.script
114select :: Markup2
115select = wrapMarkup2 Text.Blaze.Html4.Strict.select
116small :: Markup2
117small = wrapMarkup2 Text.Blaze.Html4.Strict.small
118span :: Markup2
119span = wrapMarkup2 Text.Blaze.Html4.Strict.span
120strong :: Markup2
121strong = wrapMarkup2 Text.Blaze.Html4.Strict.strong
122style :: Markup2
123style = wrapMarkup2 Text.Blaze.Html4.Strict.style
124sub :: Markup2
125sub = wrapMarkup2 Text.Blaze.Html4.Strict.sub
126sup :: Markup2
127sup = wrapMarkup2 Text.Blaze.Html4.Strict.sup
128table :: Markup2
129table = wrapMarkup2 Text.Blaze.Html4.Strict.table
130tbody :: Markup2
131tbody = wrapMarkup2 Text.Blaze.Html4.Strict.tbody
132td :: Markup2
133td = wrapMarkup2 Text.Blaze.Html4.Strict.td
134textarea :: Markup2
135textarea = wrapMarkup2 Text.Blaze.Html4.Strict.textarea
136tfoot :: Markup2
137tfoot = wrapMarkup2 Text.Blaze.Html4.Strict.tfoot
138th :: Markup2
139th = wrapMarkup2 Text.Blaze.Html4.Strict.th
140thead :: Markup2
141thead = wrapMarkup2 Text.Blaze.Html4.Strict.thead
142title :: Markup2
143title = wrapMarkup2 Text.Blaze.Html4.Strict.title
144tr :: Markup2
145tr = wrapMarkup2 Text.Blaze.Html4.Strict.tr
146tt :: Markup2
147tt = wrapMarkup2 Text.Blaze.Html4.Strict.tt
148ul :: Markup2
149ul = wrapMarkup2 Text.Blaze.Html4.Strict.ul
150var :: Markup2
151var = wrapMarkup2 Text.Blaze.Html4.Strict.var
152docType :: Markup
153docType = wrapMarkup Text.Blaze.Html4.Strict.docType
154area :: Markup
155area = wrapMarkup Text.Blaze.Html4.Strict.area
156br :: Markup
157br = wrapMarkup Text.Blaze.Html4.Strict.br
158col :: Markup
159col = wrapMarkup Text.Blaze.Html4.Strict.col
160hr :: Markup
161hr = wrapMarkup Text.Blaze.Html4.Strict.hr
162link :: Markup
163link = wrapMarkup Text.Blaze.Html4.Strict.link
164img :: Markup
165img = wrapMarkup Text.Blaze.Html4.Strict.img
166input :: Markup
167input = wrapMarkup Text.Blaze.Html4.Strict.input
168meta :: Markup
169meta = wrapMarkup Text.Blaze.Html4.Strict.meta
170param :: Markup
171param = wrapMarkup Text.Blaze.Html4.Strict.param
172
diff --git a/src/Text/BlazeT/Html4/Strict/Attributes.hs b/src/Text/BlazeT/Html4/Strict/Attributes.hs
new file mode 100644
index 0000000..18d1fe2
--- /dev/null
+++ b/src/Text/BlazeT/Html4/Strict/Attributes.hs
@@ -0,0 +1,11 @@
1-- !! DO NOT EDIT
2{-|
3(Automatically generated by @src\/Util\/GenerateHtmlTCombinators.hs:49@)
4
5This module simply reexports the corresponding @blaze-html@ module.
6-}
7module Text.BlazeT.Html4.Strict.Attributes
8 (module Text.Blaze.Html4.Strict.Attributes
9 ) where
10import Text.Blaze.Html4.Strict.Attributes
11
diff --git a/src/Text/BlazeT/Html4/Transitional.hs b/src/Text/BlazeT/Html4/Transitional.hs
new file mode 100644
index 0000000..a6dead6
--- /dev/null
+++ b/src/Text/BlazeT/Html4/Transitional.hs
@@ -0,0 +1,194 @@
1-- !! DO NOT EDIT
2{-|
3(Automatically generated by @src\/Util\/GenerateHtmlTCombinators.hs:49@)
4
5This module wraps all exports of "Text.Blaze.Html4.Transitional" using 'wrapMarkup' and 'wrapMarkup'.
6-}
7module Text.BlazeT.Html4.Transitional
8 (module Text.BlazeT.Html4.Transitional
9 ,module Text.BlazeT.Html
10 ) where
11import qualified Text.Blaze.Html4.Transitional
12import Text.BlazeT
13import Text.BlazeT.Html
14import Text.BlazeT.Internal
15
16docTypeHtml :: Markup2
17docTypeHtml = wrapMarkup2 Text.Blaze.Html4.Transitional.docTypeHtml
18a :: Markup2
19a = wrapMarkup2 Text.Blaze.Html4.Transitional.a
20abbr :: Markup2
21abbr = wrapMarkup2 Text.Blaze.Html4.Transitional.abbr
22acronym :: Markup2
23acronym = wrapMarkup2 Text.Blaze.Html4.Transitional.acronym
24address :: Markup2
25address = wrapMarkup2 Text.Blaze.Html4.Transitional.address
26b :: Markup2
27b = wrapMarkup2 Text.Blaze.Html4.Transitional.b
28bdo :: Markup2
29bdo = wrapMarkup2 Text.Blaze.Html4.Transitional.bdo
30big :: Markup2
31big = wrapMarkup2 Text.Blaze.Html4.Transitional.big
32blockquote :: Markup2
33blockquote = wrapMarkup2 Text.Blaze.Html4.Transitional.blockquote
34body :: Markup2
35body = wrapMarkup2 Text.Blaze.Html4.Transitional.body
36button :: Markup2
37button = wrapMarkup2 Text.Blaze.Html4.Transitional.button
38caption :: Markup2
39caption = wrapMarkup2 Text.Blaze.Html4.Transitional.caption
40cite :: Markup2
41cite = wrapMarkup2 Text.Blaze.Html4.Transitional.cite
42code :: Markup2
43code = wrapMarkup2 Text.Blaze.Html4.Transitional.code
44colgroup :: Markup2
45colgroup = wrapMarkup2 Text.Blaze.Html4.Transitional.colgroup
46dd :: Markup2
47dd = wrapMarkup2 Text.Blaze.Html4.Transitional.dd
48del :: Markup2
49del = wrapMarkup2 Text.Blaze.Html4.Transitional.del
50dfn :: Markup2
51dfn = wrapMarkup2 Text.Blaze.Html4.Transitional.dfn
52div :: Markup2
53div = wrapMarkup2 Text.Blaze.Html4.Transitional.div
54dl :: Markup2
55dl = wrapMarkup2 Text.Blaze.Html4.Transitional.dl
56dt :: Markup2
57dt = wrapMarkup2 Text.Blaze.Html4.Transitional.dt
58em :: Markup2
59em = wrapMarkup2 Text.Blaze.Html4.Transitional.em
60fieldset :: Markup2
61fieldset = wrapMarkup2 Text.Blaze.Html4.Transitional.fieldset
62form :: Markup2
63form = wrapMarkup2 Text.Blaze.Html4.Transitional.form
64h1 :: Markup2
65h1 = wrapMarkup2 Text.Blaze.Html4.Transitional.h1
66h2 :: Markup2
67h2 = wrapMarkup2 Text.Blaze.Html4.Transitional.h2
68h3 :: Markup2
69h3 = wrapMarkup2 Text.Blaze.Html4.Transitional.h3
70h4 :: Markup2
71h4 = wrapMarkup2 Text.Blaze.Html4.Transitional.h4
72h5 :: Markup2
73h5 = wrapMarkup2 Text.Blaze.Html4.Transitional.h5
74h6 :: Markup2
75h6 = wrapMarkup2 Text.Blaze.Html4.Transitional.h6
76head :: Markup2
77head = wrapMarkup2 Text.Blaze.Html4.Transitional.head
78html :: Markup2
79html = wrapMarkup2 Text.Blaze.Html4.Transitional.html
80i :: Markup2
81i = wrapMarkup2 Text.Blaze.Html4.Transitional.i
82ins :: Markup2
83ins = wrapMarkup2 Text.Blaze.Html4.Transitional.ins
84kbd :: Markup2
85kbd = wrapMarkup2 Text.Blaze.Html4.Transitional.kbd
86label :: Markup2
87label = wrapMarkup2 Text.Blaze.Html4.Transitional.label
88legend :: Markup2
89legend = wrapMarkup2 Text.Blaze.Html4.Transitional.legend
90li :: Markup2
91li = wrapMarkup2 Text.Blaze.Html4.Transitional.li
92map :: Markup2
93map = wrapMarkup2 Text.Blaze.Html4.Transitional.map
94noscript :: Markup2
95noscript = wrapMarkup2 Text.Blaze.Html4.Transitional.noscript
96object :: Markup2
97object = wrapMarkup2 Text.Blaze.Html4.Transitional.object
98ol :: Markup2
99ol = wrapMarkup2 Text.Blaze.Html4.Transitional.ol
100optgroup :: Markup2
101optgroup = wrapMarkup2 Text.Blaze.Html4.Transitional.optgroup
102option :: Markup2
103option = wrapMarkup2 Text.Blaze.Html4.Transitional.option
104p :: Markup2
105p = wrapMarkup2 Text.Blaze.Html4.Transitional.p
106pre :: Markup2
107pre = wrapMarkup2 Text.Blaze.Html4.Transitional.pre
108q :: Markup2
109q = wrapMarkup2 Text.Blaze.Html4.Transitional.q
110samp :: Markup2
111samp = wrapMarkup2 Text.Blaze.Html4.Transitional.samp
112script :: Markup2
113script = wrapMarkup2 Text.Blaze.Html4.Transitional.script
114select :: Markup2
115select = wrapMarkup2 Text.Blaze.Html4.Transitional.select
116small :: Markup2
117small = wrapMarkup2 Text.Blaze.Html4.Transitional.small
118span :: Markup2
119span = wrapMarkup2 Text.Blaze.Html4.Transitional.span
120strong :: Markup2
121strong = wrapMarkup2 Text.Blaze.Html4.Transitional.strong
122style :: Markup2
123style = wrapMarkup2 Text.Blaze.Html4.Transitional.style
124sub :: Markup2
125sub = wrapMarkup2 Text.Blaze.Html4.Transitional.sub
126sup :: Markup2
127sup = wrapMarkup2 Text.Blaze.Html4.Transitional.sup
128table :: Markup2
129table = wrapMarkup2 Text.Blaze.Html4.Transitional.table
130tbody :: Markup2
131tbody = wrapMarkup2 Text.Blaze.Html4.Transitional.tbody
132td :: Markup2
133td = wrapMarkup2 Text.Blaze.Html4.Transitional.td
134textarea :: Markup2
135textarea = wrapMarkup2 Text.Blaze.Html4.Transitional.textarea
136tfoot :: Markup2
137tfoot = wrapMarkup2 Text.Blaze.Html4.Transitional.tfoot
138th :: Markup2
139th = wrapMarkup2 Text.Blaze.Html4.Transitional.th
140thead :: Markup2
141thead = wrapMarkup2 Text.Blaze.Html4.Transitional.thead
142title :: Markup2
143title = wrapMarkup2 Text.Blaze.Html4.Transitional.title
144tr :: Markup2
145tr = wrapMarkup2 Text.Blaze.Html4.Transitional.tr
146tt :: Markup2
147tt = wrapMarkup2 Text.Blaze.Html4.Transitional.tt
148ul :: Markup2
149ul = wrapMarkup2 Text.Blaze.Html4.Transitional.ul
150var :: Markup2
151var = wrapMarkup2 Text.Blaze.Html4.Transitional.var
152applet :: Markup2
153applet = wrapMarkup2 Text.Blaze.Html4.Transitional.applet
154center :: Markup2
155center = wrapMarkup2 Text.Blaze.Html4.Transitional.center
156dir :: Markup2
157dir = wrapMarkup2 Text.Blaze.Html4.Transitional.dir
158font :: Markup2
159font = wrapMarkup2 Text.Blaze.Html4.Transitional.font
160iframe :: Markup2
161iframe = wrapMarkup2 Text.Blaze.Html4.Transitional.iframe
162isindex :: Markup2
163isindex = wrapMarkup2 Text.Blaze.Html4.Transitional.isindex
164menu :: Markup2
165menu = wrapMarkup2 Text.Blaze.Html4.Transitional.menu
166noframes :: Markup2
167noframes = wrapMarkup2 Text.Blaze.Html4.Transitional.noframes
168s :: Markup2
169s = wrapMarkup2 Text.Blaze.Html4.Transitional.s
170u :: Markup2
171u = wrapMarkup2 Text.Blaze.Html4.Transitional.u
172docType :: Markup
173docType = wrapMarkup Text.Blaze.Html4.Transitional.docType
174area :: Markup
175area = wrapMarkup Text.Blaze.Html4.Transitional.area
176br :: Markup
177br = wrapMarkup Text.Blaze.Html4.Transitional.br
178col :: Markup
179col = wrapMarkup Text.Blaze.Html4.Transitional.col
180hr :: Markup
181hr = wrapMarkup Text.Blaze.Html4.Transitional.hr
182link :: Markup
183link = wrapMarkup Text.Blaze.Html4.Transitional.link
184img :: Markup
185img = wrapMarkup Text.Blaze.Html4.Transitional.img
186input :: Markup
187input = wrapMarkup Text.Blaze.Html4.Transitional.input
188meta :: Markup
189meta = wrapMarkup Text.Blaze.Html4.Transitional.meta
190param :: Markup
191param = wrapMarkup Text.Blaze.Html4.Transitional.param
192basefont :: Markup
193basefont = wrapMarkup Text.Blaze.Html4.Transitional.basefont
194
diff --git a/src/Text/BlazeT/Html4/Transitional/Attributes.hs b/src/Text/BlazeT/Html4/Transitional/Attributes.hs
new file mode 100644
index 0000000..2fc0d97
--- /dev/null
+++ b/src/Text/BlazeT/Html4/Transitional/Attributes.hs
@@ -0,0 +1,11 @@
1-- !! DO NOT EDIT
2{-|
3(Automatically generated by @src\/Util\/GenerateHtmlTCombinators.hs:49@)
4
5This module simply reexports the corresponding @blaze-html@ module.
6-}
7module Text.BlazeT.Html4.Transitional.Attributes
8 (module Text.Blaze.Html4.Transitional.Attributes
9 ) where
10import Text.Blaze.Html4.Transitional.Attributes
11
diff --git a/src/Text/BlazeT/Html5.hs b/src/Text/BlazeT/Html5.hs
new file mode 100644
index 0000000..8e93bf9
--- /dev/null
+++ b/src/Text/BlazeT/Html5.hs
@@ -0,0 +1,234 @@
1-- !! DO NOT EDIT
2{-|
3(Automatically generated by @src\/Util\/GenerateHtmlTCombinators.hs:49@)
4
5This module wraps all exports of "Text.Blaze.Html5" using 'wrapMarkup' and 'wrapMarkup'.
6-}
7module Text.BlazeT.Html5
8 (module Text.BlazeT.Html5
9 ,module Text.BlazeT.Html
10 ) where
11import qualified Text.Blaze.Html5
12import Text.BlazeT
13import Text.BlazeT.Html
14import Text.BlazeT.Internal
15
16docTypeHtml :: Markup2
17docTypeHtml = wrapMarkup2 Text.Blaze.Html5.docTypeHtml
18a :: Markup2
19a = wrapMarkup2 Text.Blaze.Html5.a
20abbr :: Markup2
21abbr = wrapMarkup2 Text.Blaze.Html5.abbr
22address :: Markup2
23address = wrapMarkup2 Text.Blaze.Html5.address
24article :: Markup2
25article = wrapMarkup2 Text.Blaze.Html5.article
26aside :: Markup2
27aside = wrapMarkup2 Text.Blaze.Html5.aside
28audio :: Markup2
29audio = wrapMarkup2 Text.Blaze.Html5.audio
30b :: Markup2
31b = wrapMarkup2 Text.Blaze.Html5.b
32bdo :: Markup2
33bdo = wrapMarkup2 Text.Blaze.Html5.bdo
34blockquote :: Markup2
35blockquote = wrapMarkup2 Text.Blaze.Html5.blockquote
36body :: Markup2
37body = wrapMarkup2 Text.Blaze.Html5.body
38button :: Markup2
39button = wrapMarkup2 Text.Blaze.Html5.button
40canvas :: Markup2
41canvas = wrapMarkup2 Text.Blaze.Html5.canvas
42caption :: Markup2
43caption = wrapMarkup2 Text.Blaze.Html5.caption
44cite :: Markup2
45cite = wrapMarkup2 Text.Blaze.Html5.cite
46code :: Markup2
47code = wrapMarkup2 Text.Blaze.Html5.code
48colgroup :: Markup2
49colgroup = wrapMarkup2 Text.Blaze.Html5.colgroup
50command :: Markup2
51command = wrapMarkup2 Text.Blaze.Html5.command
52datalist :: Markup2
53datalist = wrapMarkup2 Text.Blaze.Html5.datalist
54dd :: Markup2
55dd = wrapMarkup2 Text.Blaze.Html5.dd
56del :: Markup2
57del = wrapMarkup2 Text.Blaze.Html5.del
58details :: Markup2
59details = wrapMarkup2 Text.Blaze.Html5.details
60dfn :: Markup2
61dfn = wrapMarkup2 Text.Blaze.Html5.dfn
62div :: Markup2
63div = wrapMarkup2 Text.Blaze.Html5.div
64dl :: Markup2
65dl = wrapMarkup2 Text.Blaze.Html5.dl
66dt :: Markup2
67dt = wrapMarkup2 Text.Blaze.Html5.dt
68em :: Markup2
69em = wrapMarkup2 Text.Blaze.Html5.em
70fieldset :: Markup2
71fieldset = wrapMarkup2 Text.Blaze.Html5.fieldset
72figcaption :: Markup2
73figcaption = wrapMarkup2 Text.Blaze.Html5.figcaption
74figure :: Markup2
75figure = wrapMarkup2 Text.Blaze.Html5.figure
76footer :: Markup2
77footer = wrapMarkup2 Text.Blaze.Html5.footer
78form :: Markup2
79form = wrapMarkup2 Text.Blaze.Html5.form
80h1 :: Markup2
81h1 = wrapMarkup2 Text.Blaze.Html5.h1
82h2 :: Markup2
83h2 = wrapMarkup2 Text.Blaze.Html5.h2
84h3 :: Markup2
85h3 = wrapMarkup2 Text.Blaze.Html5.h3
86h4 :: Markup2
87h4 = wrapMarkup2 Text.Blaze.Html5.h4
88h5 :: Markup2
89h5 = wrapMarkup2 Text.Blaze.Html5.h5
90h6 :: Markup2
91h6 = wrapMarkup2 Text.Blaze.Html5.h6
92head :: Markup2
93head = wrapMarkup2 Text.Blaze.Html5.head
94header :: Markup2
95header = wrapMarkup2 Text.Blaze.Html5.header
96hgroup :: Markup2
97hgroup = wrapMarkup2 Text.Blaze.Html5.hgroup
98html :: Markup2
99html = wrapMarkup2 Text.Blaze.Html5.html
100i :: Markup2
101i = wrapMarkup2 Text.Blaze.Html5.i
102iframe :: Markup2
103iframe = wrapMarkup2 Text.Blaze.Html5.iframe
104ins :: Markup2
105ins = wrapMarkup2 Text.Blaze.Html5.ins
106kbd :: Markup2
107kbd = wrapMarkup2 Text.Blaze.Html5.kbd
108label :: Markup2
109label = wrapMarkup2 Text.Blaze.Html5.label
110legend :: Markup2
111legend = wrapMarkup2 Text.Blaze.Html5.legend
112li :: Markup2
113li = wrapMarkup2 Text.Blaze.Html5.li
114main :: Markup2
115main = wrapMarkup2 Text.Blaze.Html5.main
116map :: Markup2
117map = wrapMarkup2 Text.Blaze.Html5.map
118mark :: Markup2
119mark = wrapMarkup2 Text.Blaze.Html5.mark
120menu :: Markup2
121menu = wrapMarkup2 Text.Blaze.Html5.menu
122meter :: Markup2
123meter = wrapMarkup2 Text.Blaze.Html5.meter
124nav :: Markup2
125nav = wrapMarkup2 Text.Blaze.Html5.nav
126noscript :: Markup2
127noscript = wrapMarkup2 Text.Blaze.Html5.noscript
128object :: Markup2
129object = wrapMarkup2 Text.Blaze.Html5.object
130ol :: Markup2
131ol = wrapMarkup2 Text.Blaze.Html5.ol
132optgroup :: Markup2
133optgroup = wrapMarkup2 Text.Blaze.Html5.optgroup
134option :: Markup2
135option = wrapMarkup2 Text.Blaze.Html5.option
136output :: Markup2
137output = wrapMarkup2 Text.Blaze.Html5.output
138p :: Markup2
139p = wrapMarkup2 Text.Blaze.Html5.p
140pre :: Markup2
141pre = wrapMarkup2 Text.Blaze.Html5.pre
142progress :: Markup2
143progress = wrapMarkup2 Text.Blaze.Html5.progress
144q :: Markup2
145q = wrapMarkup2 Text.Blaze.Html5.q
146rp :: Markup2
147rp = wrapMarkup2 Text.Blaze.Html5.rp
148rt :: Markup2
149rt = wrapMarkup2 Text.Blaze.Html5.rt
150ruby :: Markup2
151ruby = wrapMarkup2 Text.Blaze.Html5.ruby
152samp :: Markup2
153samp = wrapMarkup2 Text.Blaze.Html5.samp
154script :: Markup2
155script = wrapMarkup2 Text.Blaze.Html5.script
156section :: Markup2
157section = wrapMarkup2 Text.Blaze.Html5.section
158select :: Markup2
159select = wrapMarkup2 Text.Blaze.Html5.select
160small :: Markup2
161small = wrapMarkup2 Text.Blaze.Html5.small
162span :: Markup2
163span = wrapMarkup2 Text.Blaze.Html5.span
164strong :: Markup2
165strong = wrapMarkup2 Text.Blaze.Html5.strong
166style :: Markup2
167style = wrapMarkup2 Text.Blaze.Html5.style
168sub :: Markup2
169sub = wrapMarkup2 Text.Blaze.Html5.sub
170summary :: Markup2
171summary = wrapMarkup2 Text.Blaze.Html5.summary
172sup :: Markup2
173sup = wrapMarkup2 Text.Blaze.Html5.sup
174table :: Markup2
175table = wrapMarkup2 Text.Blaze.Html5.table
176tbody :: Markup2
177tbody = wrapMarkup2 Text.Blaze.Html5.tbody
178td :: Markup2
179td = wrapMarkup2 Text.Blaze.Html5.td
180textarea :: Markup2
181textarea = wrapMarkup2 Text.Blaze.Html5.textarea
182tfoot :: Markup2
183tfoot = wrapMarkup2 Text.Blaze.Html5.tfoot
184th :: Markup2
185th = wrapMarkup2 Text.Blaze.Html5.th
186thead :: Markup2
187thead = wrapMarkup2 Text.Blaze.Html5.thead
188time :: Markup2
189time = wrapMarkup2 Text.Blaze.Html5.time
190title :: Markup2
191title = wrapMarkup2 Text.Blaze.Html5.title
192tr :: Markup2
193tr = wrapMarkup2 Text.Blaze.Html5.tr
194ul :: Markup2
195ul = wrapMarkup2 Text.Blaze.Html5.ul
196var :: Markup2
197var = wrapMarkup2 Text.Blaze.Html5.var
198video :: Markup2
199video = wrapMarkup2 Text.Blaze.Html5.video
200docType :: Markup
201docType = wrapMarkup Text.Blaze.Html5.docType
202area :: Markup
203area = wrapMarkup Text.Blaze.Html5.area
204base :: Markup
205base = wrapMarkup Text.Blaze.Html5.base
206br :: Markup
207br = wrapMarkup Text.Blaze.Html5.br
208col :: Markup
209col = wrapMarkup Text.Blaze.Html5.col
210embed :: Markup
211embed = wrapMarkup Text.Blaze.Html5.embed
212hr :: Markup
213hr = wrapMarkup Text.Blaze.Html5.hr
214img :: Markup
215img = wrapMarkup Text.Blaze.Html5.img
216input :: Markup
217input = wrapMarkup Text.Blaze.Html5.input
218keygen :: Markup
219keygen = wrapMarkup Text.Blaze.Html5.keygen
220link :: Markup
221link = wrapMarkup Text.Blaze.Html5.link
222menuitem :: Markup
223menuitem = wrapMarkup Text.Blaze.Html5.menuitem
224meta :: Markup
225meta = wrapMarkup Text.Blaze.Html5.meta
226param :: Markup
227param = wrapMarkup Text.Blaze.Html5.param
228source :: Markup
229source = wrapMarkup Text.Blaze.Html5.source
230track :: Markup
231track = wrapMarkup Text.Blaze.Html5.track
232wbr :: Markup
233wbr = wrapMarkup Text.Blaze.Html5.wbr
234
diff --git a/src/Text/BlazeT/Html5/Attributes.hs b/src/Text/BlazeT/Html5/Attributes.hs
new file mode 100644
index 0000000..1bcd773
--- /dev/null
+++ b/src/Text/BlazeT/Html5/Attributes.hs
@@ -0,0 +1,11 @@
1-- !! DO NOT EDIT
2{-|
3(Automatically generated by @src\/Util\/GenerateHtmlTCombinators.hs:49@)
4
5This module simply reexports the corresponding @blaze-html@ module.
6-}
7module Text.BlazeT.Html5.Attributes
8 (module Text.Blaze.Html5.Attributes
9 ) where
10import Text.Blaze.Html5.Attributes
11
diff --git a/src/Text/BlazeT/Internal.hs b/src/Text/BlazeT/Internal.hs
new file mode 100644
index 0000000..24ef1fe
--- /dev/null
+++ b/src/Text/BlazeT/Internal.hs
@@ -0,0 +1,238 @@
1{-# LANGUAGE DeriveFunctor #-}
2{-# LANGUAGE GeneralizedNewtypeDeriving #-}
3{-# LANGUAGE FlexibleInstances #-}
4{-# LANGUAGE RankNTypes #-}
5{-# LANGUAGE CPP #-}
6#if MIN_VERSION_blaze_markup(0,7,1)
7#define PRE_BUILDER
8#endif
9module Text.BlazeT.Internal
10 (
11 -- * Important types.
12 B.ChoiceString (..)
13 , B.StaticString (..)
14 , MarkupM
15 , Markup
16 , B.Tag
17 , B.Attribute
18 , B.AttributeValue
19
20 -- * Creating custom tags and attributes.
21 , customParent
22 , customLeaf
23 , B.attribute
24 , B.dataAttribute
25 , B.customAttribute
26
27 -- * Converting values to Markup.
28 , text
29 , preEscapedText
30 , lazyText
31 , preEscapedLazyText
32 , textBuilder
33 , preEscapedTextBuilder
34 , string
35 , preEscapedString
36 , unsafeByteString
37 , unsafeLazyByteString
38
39 -- * Comments
40 , B.textComment
41 , B.lazyTextComment
42 , B.stringComment
43 , B.unsafeByteStringComment
44 , B.unsafeLazyByteStringComment
45
46 -- * Converting values to tags.
47 , B.textTag
48 , B.stringTag
49
50 -- * Converting values to attribute values.
51 , B.textValue
52 , B.preEscapedTextValue
53 , B.lazyTextValue
54 , B.preEscapedLazyTextValue
55 , B.textBuilderValue
56 , B.preEscapedTextBuilderValue
57 , B.stringValue
58 , B.preEscapedStringValue
59 , B.unsafeByteStringValue
60 , B.unsafeLazyByteStringValue
61
62 -- * Setting attributes
63 , B.Attributable
64 , (B.!)
65 , (B.!?)
66
67 -- * Modifying Markup elements
68 , contents
69 , external
70
71 -- * Querying Markup elements
72 , null
73
74 -- * BlazeT new stuff
75 ,Markup2
76 ,mapMarkupT
77 ,MarkupT
78 ,runMarkup
79 ,runMarkupT
80 ,execMarkup
81 ,execMarkupT
82 ,wrapMarkup
83 ,wrapMarkupT
84 ,wrapMarkup2
85 ,wrapMarkupT2
86 ) where
87
88import Control.Monad.Identity
89import Control.Monad.Trans.Class
90import Control.Monad.Writer.Strict
91import qualified Data.ByteString as BS
92import qualified Data.ByteString.Lazy as BL
93import Data.String
94import qualified Data.Text as T
95import qualified Data.Text.Lazy as LT
96import qualified Data.Text.Lazy.Builder as LTB
97import qualified Text.Blaze as B
98import qualified Text.Blaze.Internal as B
99
100newtype MarkupT m a= MarkupT { fromMarkupT :: WriterT B.Markup m a }
101 deriving (Functor
102#if MIN_VERSION_base(4,8,0)
103 ,Applicative
104#endif
105 ,Monad
106 ,MonadWriter B.Markup
107 ,MonadTrans
108 )
109
110-- | Map both the return value and markup of a computation using the
111-- given function
112mapMarkupT :: (m (a,B.Markup) -> n (b,B.Markup)) -> MarkupT m a -> MarkupT n b
113mapMarkupT f = MarkupT . mapWriterT f . fromMarkupT
114{-# INLINE mapMarkupT #-}
115
116type MarkupM = MarkupT Identity
117type Markup = forall m . Monad m => MarkupT m ()
118type Markup2 = forall m . Monad m => MarkupT m () -> MarkupT m ()
119
120runMarkupT :: MarkupT m a -> m (a,B.Markup)
121runMarkupT = runWriterT . fromMarkupT
122{-# INLINE runMarkupT #-}
123
124execMarkupT :: Monad m => MarkupT m a -> m B.Markup
125execMarkupT = liftM snd . runMarkupT
126{-# INLINE execMarkupT #-}
127
128runMarkup :: MarkupM a -> (a,B.Markup)
129runMarkup = runIdentity . runMarkupT
130{-# INLINE runMarkup #-}
131
132execMarkup :: MarkupM a -> B.Markup
133execMarkup = snd . runMarkup
134{-# INLINE execMarkup #-}
135
136-- instance MonadTrans MarkupT where
137
138
139instance (Monad m,Monoid a) => Monoid (MarkupT m a) where
140 mempty = return mempty
141 {-# INLINE mempty #-}
142 a `mappend` b = do {a' <- a; b >>= return . (mappend a')}
143 {-# INLINE mappend #-}
144
145
146instance Monad m => B.Attributable (MarkupT m a) where
147 h ! a = wrapMarkupT2 (B.! a) h
148 {-# INLINE (!) #-}
149
150instance Monad m => B.Attributable (a -> MarkupT m b) where
151 h ! a = \x -> wrapMarkupT2 (B.! a) $ h x
152 {-# INLINE (!) #-}
153
154instance Monad m => IsString (MarkupT m ()) where
155 fromString = wrapMarkup . fromString
156 {-# INLINE fromString #-}
157
158wrapMarkupT :: Monad m => B.Markup -> MarkupT m ()
159wrapMarkupT = tell
160{-# INLINE wrapMarkupT #-}
161
162wrapMarkup :: B.Markup -> Markup
163wrapMarkup = wrapMarkupT
164{-# INLINE wrapMarkup #-}
165
166wrapMarkupT2 :: Monad m => (B.Markup -> B.Markup)
167 -> MarkupT m a -> MarkupT m a
168wrapMarkupT2 = censor
169{-# INLINE wrapMarkupT2 #-}
170
171wrapMarkup2 :: (B.Markup -> B.Markup) -> Markup2
172wrapMarkup2 = wrapMarkupT2
173{-# INLINE wrapMarkup2 #-}
174
175unsafeByteString :: BS.ByteString -> Markup
176unsafeByteString = wrapMarkup . B.unsafeByteString
177{-# INLINE unsafeByteString #-}
178
179-- | Insert a lazy 'BL.ByteString'. See 'unsafeByteString' for reasons why this
180-- is an unsafe operation.
181--
182unsafeLazyByteString :: BL.ByteString -- ^ Value to insert
183 -> Markup -- ^ Resulting HTML fragment
184unsafeLazyByteString = wrapMarkup . B.unsafeLazyByteString
185{-# INLINE unsafeLazyByteString #-}
186
187external :: Monad m => MarkupT m a -> MarkupT m a
188external = wrapMarkupT2 B.external
189{-# INLINE external #-}
190
191contents :: Monad m => MarkupT m a -> MarkupT m a
192contents = wrapMarkupT2 B.contents
193{-# INLINE contents #-}
194
195customParent ::B.Tag -> Markup2
196customParent = wrapMarkup2 . B.customParent
197{-# INLINE customParent #-}
198
199customLeaf :: B.Tag -> Bool -> Markup
200customLeaf = fmap wrapMarkup . B.customLeaf
201{-# INLINE customLeaf #-}
202
203preEscapedText :: T.Text -> Markup
204preEscapedText = wrapMarkup . B.preEscapedText
205{-# INLINE preEscapedText #-}
206
207preEscapedLazyText :: LT.Text -> Markup
208preEscapedLazyText = wrapMarkup . B.preEscapedLazyText
209{-# INLINE preEscapedLazyText #-}
210
211preEscapedTextBuilder :: LTB.Builder -> Markup
212textBuilder :: LTB.Builder -> Markup
213
214#ifdef PRE_BUILDER
215preEscapedTextBuilder = wrapMarkup . B.preEscapedTextBuilder
216textBuilder = wrapMarkup . B.textBuilder
217{-# INLINE preEscapedTextBuilder #-}
218{-# INLINE textBuilder #-}
219#else
220preEscapedTextBuilder = error "This function needs blaze-markup 0.7.1.0"
221textBuilder = error "This function needs blaze-markup 0.7.1.0"
222#endif
223
224preEscapedString :: String -> Markup
225preEscapedString = wrapMarkup . B.preEscapedString
226{-# INLINE preEscapedString #-}
227
228string :: String -> Markup
229string = wrapMarkup . B.string
230{-# INLINE string #-}
231
232text :: T.Text -> Markup
233text = wrapMarkup . B.text
234{-# INLINE text #-}
235
236lazyText :: LT.Text -> Markup
237lazyText = wrapMarkup . B.lazyText
238{-# INLINE lazyText #-}
diff --git a/src/Text/BlazeT/Renderer/Pretty.hs b/src/Text/BlazeT/Renderer/Pretty.hs
new file mode 100644
index 0000000..8977c94
--- /dev/null
+++ b/src/Text/BlazeT/Renderer/Pretty.hs
@@ -0,0 +1,22 @@
1module Text.BlazeT.Renderer.Pretty
2 ( renderMarkup
3 , renderHtml
4 , renderMarkupT
5 , renderHtmlT
6 ) where
7
8import Control.Monad
9import Control.Monad.Identity
10import qualified Text.Blaze.Renderer.Pretty as BU
11import Text.BlazeT
12
13renderMarkup :: MarkupM a -> String
14renderMarkup = runIdentity . renderMarkupT
15renderMarkupT :: Monad m => MarkupT m a -> m String
16renderMarkupT = liftM BU.renderMarkup . execMarkupT
17
18renderHtml :: MarkupM a -> String
19renderHtml = renderMarkup
20renderHtmlT :: Monad m => MarkupT m a -> m String
21renderHtmlT = renderMarkupT
22
diff --git a/src/Text/BlazeT/Renderer/String.hs b/src/Text/BlazeT/Renderer/String.hs
new file mode 100644
index 0000000..0a2de8a
--- /dev/null
+++ b/src/Text/BlazeT/Renderer/String.hs
@@ -0,0 +1,27 @@
1module Text.BlazeT.Renderer.String
2 ( fromChoiceString
3 , renderMarkup
4 , renderHtml
5 , renderMarkupT
6 , renderHtmlT
7 ) where
8
9import Control.Monad
10import Control.Monad.Identity
11import Text.Blaze.Internal (ChoiceString)
12import qualified Text.Blaze.Renderer.String as BU
13import Text.BlazeT
14
15fromChoiceString :: ChoiceString -> String -> String
16fromChoiceString = BU.fromChoiceString
17
18renderMarkup :: MarkupM a -> String
19renderMarkup = runIdentity . renderMarkupT
20renderMarkupT :: Monad m => MarkupT m a -> m String
21renderMarkupT = liftM BU.renderMarkup . execMarkupT
22
23renderHtml :: MarkupM a -> String
24renderHtml = renderMarkup
25renderHtmlT :: Monad m => MarkupT m a -> m String
26renderHtmlT = renderMarkupT
27
diff --git a/src/Text/BlazeT/Renderer/Text.hs b/src/Text/BlazeT/Renderer/Text.hs
new file mode 100644
index 0000000..31181eb
--- /dev/null
+++ b/src/Text/BlazeT/Renderer/Text.hs
@@ -0,0 +1,75 @@
1module Text.BlazeT.Renderer.Text
2 ( renderMarkupBuilderT
3 , renderMarkupBuilder
4 , renderMarkupBuilderWithT
5 , renderMarkupT
6 , renderMarkupWithT
7 , renderHtmlBuilderT
8 , renderHtmlBuilderWithT
9 , renderHtmlT
10 , renderHtmlWithT
11 , renderMarkupBuilderWith
12 , renderMarkup
13 , renderMarkupWith
14 , renderHtmlBuilder
15 , renderHtmlBuilderWith
16 , renderHtml
17 , renderHtmlWith
18 ) where
19
20import Control.Monad
21import Data.ByteString (ByteString)
22import Control.Monad.Identity
23import Data.Text (Text)
24import qualified Data.Text.Lazy as L
25import qualified Data.Text.Lazy.Builder as B
26import qualified Text.Blaze.Html.Renderer.Text as BH
27import qualified Text.Blaze.Renderer.Text as BU
28import Text.BlazeT
29
30renderMarkupBuilder :: MarkupM a -> B.Builder
31renderMarkupBuilder = runIdentity . renderMarkupBuilderT
32
33renderMarkupBuilderT :: Monad m => MarkupT m a -> m B.Builder
34renderMarkupBuilderT = liftM BU.renderMarkupBuilder . execMarkupT
35
36renderHtmlBuilder :: MarkupM a -> B.Builder
37renderHtmlBuilder = renderMarkupBuilder
38
39renderHtmlBuilderT :: Monad m => MarkupT m a -> m B.Builder
40renderHtmlBuilderT = renderMarkupBuilderT
41
42renderMarkup :: MarkupM a -> L.Text
43renderMarkup = runIdentity . renderMarkupT
44renderMarkupT :: Monad m => MarkupT m a -> m L.Text
45renderMarkupT = liftM BU.renderMarkup . execMarkupT
46
47renderHtml :: MarkupM a -> L.Text
48renderHtml = renderMarkup
49renderHtmlT :: Monad m => MarkupT m a -> m L.Text
50renderHtmlT = renderMarkupT
51
52renderMarkupWithT :: Monad m => (ByteString -> Text) -> MarkupT m a -> m L.Text
53renderMarkupWithT g = liftM (BU.renderMarkupWith g) . execMarkupT
54
55renderMarkupWith :: (ByteString -> Text) -> MarkupM a -> L.Text
56renderMarkupWith g = runIdentity . renderMarkupWithT g
57
58renderHtmlWithT :: Monad m => (ByteString -> Text) -> MarkupT m a -> m L.Text
59renderHtmlWithT g = liftM (BH.renderHtmlWith g) . execMarkupT
60
61renderHtmlWith :: (ByteString -> Text) -> MarkupM a -> L.Text
62renderHtmlWith g = runIdentity . renderHtmlWithT g
63
64renderHtmlBuilderWithT :: Monad m => (ByteString -> Text) -> MarkupT m a -> m B.Builder
65renderHtmlBuilderWithT g = liftM (BH.renderHtmlBuilderWith g) . execMarkupT
66
67renderHtmlBuilderWith :: (ByteString -> Text) -> MarkupM a -> B.Builder
68renderHtmlBuilderWith g = runIdentity . renderHtmlBuilderWithT g
69
70
71renderMarkupBuilderWithT :: Monad m => (ByteString -> Text) -> MarkupT m a -> m B.Builder
72renderMarkupBuilderWithT g = liftM (BU.renderMarkupBuilderWith g) . execMarkupT
73
74renderMarkupBuilderWith :: (ByteString -> Text) -> MarkupM a -> B.Builder
75renderMarkupBuilderWith g = runIdentity . renderMarkupBuilderWithT g
diff --git a/src/Text/BlazeT/Renderer/Utf8.hs b/src/Text/BlazeT/Renderer/Utf8.hs
new file mode 100644
index 0000000..292f81f
--- /dev/null
+++ b/src/Text/BlazeT/Renderer/Utf8.hs
@@ -0,0 +1,66 @@
1{-# OPTIONS_GHC -fsimpl-tick-factor=230 #-}
2
3-- the above option was not needed with
4 -- ,blaze-html >= 0.6.0.0 && < 0.7.0.0
5 -- ,blaze-builder >= 0.2
6 -- ,text < 1.2
7
8module Text.BlazeT.Renderer.Utf8
9 (
10 renderMarkupBuilder
11 , renderMarkup
12 , renderMarkupToByteStringIO
13 , renderHtmlBuilder
14 , renderHtml
15 , renderHtmlToByteStringIO
16
17 -- * new BlazeT stuff
18 , renderMarkupBuilderT
19 , renderMarkupT
20 , renderMarkupToByteStringIOT
21 , renderHtmlToByteStringIOT
22 , renderHtmlBuilderT
23 , renderHtmlT
24 ) where
25
26import qualified Blaze.ByteString.Builder as B
27import Control.Monad
28import Control.Monad.Identity
29import qualified Data.ByteString as BS
30import qualified Data.ByteString.Lazy as BL
31import qualified Text.Blaze.Renderer.Utf8 as BU
32import Text.BlazeT
33
34renderMarkupBuilder :: MarkupM a -> B.Builder
35renderMarkupBuilder = runIdentity . renderMarkupBuilderT
36
37renderMarkupBuilderT :: Monad m => MarkupT m a -> m B.Builder
38renderMarkupBuilderT = liftM BU.renderMarkupBuilder . execMarkupT
39
40renderHtmlBuilder :: MarkupM a -> B.Builder
41renderHtmlBuilder = renderMarkupBuilder
42
43renderHtmlBuilderT :: Monad m => MarkupT m a -> m B.Builder
44renderHtmlBuilderT = renderMarkupBuilderT
45
46renderMarkup :: MarkupM a -> BL.ByteString
47renderMarkup = runIdentity . renderMarkupT
48renderMarkupT :: Monad m => MarkupT m a -> m BL.ByteString
49renderMarkupT = liftM BU.renderMarkup . execMarkupT
50
51renderHtml :: MarkupM a -> BL.ByteString
52renderHtml = renderMarkup
53renderHtmlT :: Monad m => MarkupT m a -> m BL.ByteString
54renderHtmlT = renderMarkupT
55
56renderMarkupToByteStringIO :: (BS.ByteString -> IO ()) -> MarkupM a -> IO ()
57renderMarkupToByteStringIO g = runIdentity . renderMarkupToByteStringIOT g
58renderMarkupToByteStringIOT :: Monad m => (BS.ByteString -> IO ()) ->
59 MarkupT m a -> m (IO ())
60renderMarkupToByteStringIOT g = liftM (BU.renderMarkupToByteStringIO g) . execMarkupT
61
62renderHtmlToByteStringIO :: (BS.ByteString -> IO ()) -> MarkupM a -> IO ()
63renderHtmlToByteStringIO g = runIdentity . renderMarkupToByteStringIOT g
64renderHtmlToByteStringIOT :: Monad m => (BS.ByteString -> IO ()) ->
65 MarkupT m a -> m (IO ())
66renderHtmlToByteStringIOT g = liftM (BU.renderMarkupToByteStringIO g) . execMarkupT
diff --git a/src/Text/BlazeT/XHtml1/FrameSet.hs b/src/Text/BlazeT/XHtml1/FrameSet.hs
new file mode 100644
index 0000000..57edcd5
--- /dev/null
+++ b/src/Text/BlazeT/XHtml1/FrameSet.hs
@@ -0,0 +1,198 @@
1-- !! DO NOT EDIT
2{-|
3(Automatically generated by @src\/Util\/GenerateHtmlTCombinators.hs:49@)
4
5This module wraps all exports of "Text.Blaze.XHtml1.FrameSet" using 'wrapMarkup' and 'wrapMarkup'.
6-}
7module Text.BlazeT.XHtml1.FrameSet
8 (module Text.BlazeT.XHtml1.FrameSet
9 ,module Text.BlazeT.Html
10 ) where
11import qualified Text.Blaze.XHtml1.FrameSet
12import Text.BlazeT
13import Text.BlazeT.Html
14import Text.BlazeT.Internal
15
16docTypeHtml :: Markup2
17docTypeHtml = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.docTypeHtml
18a :: Markup2
19a = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.a
20abbr :: Markup2
21abbr = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.abbr
22acronym :: Markup2
23acronym = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.acronym
24address :: Markup2
25address = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.address
26b :: Markup2
27b = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.b
28bdo :: Markup2
29bdo = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.bdo
30big :: Markup2
31big = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.big
32blockquote :: Markup2
33blockquote = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.blockquote
34body :: Markup2
35body = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.body
36button :: Markup2
37button = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.button
38caption :: Markup2
39caption = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.caption
40cite :: Markup2
41cite = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.cite
42code :: Markup2
43code = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.code
44colgroup :: Markup2
45colgroup = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.colgroup
46dd :: Markup2
47dd = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.dd
48del :: Markup2
49del = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.del
50dfn :: Markup2
51dfn = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.dfn
52div :: Markup2
53div = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.div
54dl :: Markup2
55dl = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.dl
56dt :: Markup2
57dt = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.dt
58em :: Markup2
59em = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.em
60fieldset :: Markup2
61fieldset = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.fieldset
62form :: Markup2
63form = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.form
64h1 :: Markup2
65h1 = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.h1
66h2 :: Markup2
67h2 = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.h2
68h3 :: Markup2
69h3 = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.h3
70h4 :: Markup2
71h4 = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.h4
72h5 :: Markup2
73h5 = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.h5
74h6 :: Markup2
75h6 = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.h6
76head :: Markup2
77head = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.head
78html :: Markup2
79html = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.html
80i :: Markup2
81i = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.i
82ins :: Markup2
83ins = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.ins
84kbd :: Markup2
85kbd = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.kbd
86label :: Markup2
87label = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.label
88legend :: Markup2
89legend = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.legend
90li :: Markup2
91li = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.li
92map :: Markup2
93map = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.map
94noscript :: Markup2
95noscript = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.noscript
96object :: Markup2
97object = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.object
98ol :: Markup2
99ol = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.ol
100optgroup :: Markup2
101optgroup = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.optgroup
102option :: Markup2
103option = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.option
104p :: Markup2
105p = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.p
106pre :: Markup2
107pre = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.pre
108q :: Markup2
109q = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.q
110samp :: Markup2
111samp = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.samp
112script :: Markup2
113script = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.script
114select :: Markup2
115select = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.select
116small :: Markup2
117small = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.small
118span :: Markup2
119span = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.span
120strong :: Markup2
121strong = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.strong
122style :: Markup2
123style = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.style
124sub :: Markup2
125sub = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.sub
126sup :: Markup2
127sup = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.sup
128table :: Markup2
129table = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.table
130tbody :: Markup2
131tbody = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.tbody
132td :: Markup2
133td = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.td
134textarea :: Markup2
135textarea = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.textarea
136tfoot :: Markup2
137tfoot = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.tfoot
138th :: Markup2
139th = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.th
140thead :: Markup2
141thead = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.thead
142title :: Markup2
143title = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.title
144tr :: Markup2
145tr = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.tr
146tt :: Markup2
147tt = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.tt
148ul :: Markup2
149ul = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.ul
150var :: Markup2
151var = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.var
152applet :: Markup2
153applet = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.applet
154center :: Markup2
155center = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.center
156dir :: Markup2
157dir = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.dir
158font :: Markup2
159font = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.font
160iframe :: Markup2
161iframe = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.iframe
162isindex :: Markup2
163isindex = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.isindex
164menu :: Markup2
165menu = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.menu
166noframes :: Markup2
167noframes = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.noframes
168s :: Markup2
169s = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.s
170u :: Markup2
171u = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.u
172frameset :: Markup2
173frameset = wrapMarkup2 Text.Blaze.XHtml1.FrameSet.frameset
174docType :: Markup
175docType = wrapMarkup Text.Blaze.XHtml1.FrameSet.docType
176area :: Markup
177area = wrapMarkup Text.Blaze.XHtml1.FrameSet.area
178br :: Markup
179br = wrapMarkup Text.Blaze.XHtml1.FrameSet.br
180col :: Markup
181col = wrapMarkup Text.Blaze.XHtml1.FrameSet.col
182hr :: Markup
183hr = wrapMarkup Text.Blaze.XHtml1.FrameSet.hr
184link :: Markup
185link = wrapMarkup Text.Blaze.XHtml1.FrameSet.link
186img :: Markup
187img = wrapMarkup Text.Blaze.XHtml1.FrameSet.img
188input :: Markup
189input = wrapMarkup Text.Blaze.XHtml1.FrameSet.input
190meta :: Markup
191meta = wrapMarkup Text.Blaze.XHtml1.FrameSet.meta
192param :: Markup
193param = wrapMarkup Text.Blaze.XHtml1.FrameSet.param
194basefont :: Markup
195basefont = wrapMarkup Text.Blaze.XHtml1.FrameSet.basefont
196frame :: Markup
197frame = wrapMarkup Text.Blaze.XHtml1.FrameSet.frame
198
diff --git a/src/Text/BlazeT/XHtml1/FrameSet/Attributes.hs b/src/Text/BlazeT/XHtml1/FrameSet/Attributes.hs
new file mode 100644
index 0000000..af4ecbe
--- /dev/null
+++ b/src/Text/BlazeT/XHtml1/FrameSet/Attributes.hs
@@ -0,0 +1,11 @@
1-- !! DO NOT EDIT
2{-|
3(Automatically generated by @src\/Util\/GenerateHtmlTCombinators.hs:49@)
4
5This module simply reexports the corresponding @blaze-html@ module.
6-}
7module Text.BlazeT.XHtml1.FrameSet.Attributes
8 (module Text.Blaze.XHtml1.FrameSet.Attributes
9 ) where
10import Text.Blaze.XHtml1.FrameSet.Attributes
11
diff --git a/src/Text/BlazeT/XHtml1/Strict.hs b/src/Text/BlazeT/XHtml1/Strict.hs
new file mode 100644
index 0000000..0bca241
--- /dev/null
+++ b/src/Text/BlazeT/XHtml1/Strict.hs
@@ -0,0 +1,172 @@
1-- !! DO NOT EDIT
2{-|
3(Automatically generated by @src\/Util\/GenerateHtmlTCombinators.hs:49@)
4
5This module wraps all exports of "Text.Blaze.XHtml1.Strict" using 'wrapMarkup' and 'wrapMarkup'.
6-}
7module Text.BlazeT.XHtml1.Strict
8 (module Text.BlazeT.XHtml1.Strict
9 ,module Text.BlazeT.Html
10 ) where
11import qualified Text.Blaze.XHtml1.Strict
12import Text.BlazeT
13import Text.BlazeT.Html
14import Text.BlazeT.Internal
15
16docTypeHtml :: Markup2
17docTypeHtml = wrapMarkup2 Text.Blaze.XHtml1.Strict.docTypeHtml
18a :: Markup2
19a = wrapMarkup2 Text.Blaze.XHtml1.Strict.a
20abbr :: Markup2
21abbr = wrapMarkup2 Text.Blaze.XHtml1.Strict.abbr
22acronym :: Markup2
23acronym = wrapMarkup2 Text.Blaze.XHtml1.Strict.acronym
24address :: Markup2
25address = wrapMarkup2 Text.Blaze.XHtml1.Strict.address
26b :: Markup2
27b = wrapMarkup2 Text.Blaze.XHtml1.Strict.b
28bdo :: Markup2
29bdo = wrapMarkup2 Text.Blaze.XHtml1.Strict.bdo
30big :: Markup2
31big = wrapMarkup2 Text.Blaze.XHtml1.Strict.big
32blockquote :: Markup2
33blockquote = wrapMarkup2 Text.Blaze.XHtml1.Strict.blockquote
34body :: Markup2
35body = wrapMarkup2 Text.Blaze.XHtml1.Strict.body
36button :: Markup2
37button = wrapMarkup2 Text.Blaze.XHtml1.Strict.button
38caption :: Markup2
39caption = wrapMarkup2 Text.Blaze.XHtml1.Strict.caption
40cite :: Markup2
41cite = wrapMarkup2 Text.Blaze.XHtml1.Strict.cite
42code :: Markup2
43code = wrapMarkup2 Text.Blaze.XHtml1.Strict.code
44colgroup :: Markup2
45colgroup = wrapMarkup2 Text.Blaze.XHtml1.Strict.colgroup
46dd :: Markup2
47dd = wrapMarkup2 Text.Blaze.XHtml1.Strict.dd
48del :: Markup2
49del = wrapMarkup2 Text.Blaze.XHtml1.Strict.del
50dfn :: Markup2
51dfn = wrapMarkup2 Text.Blaze.XHtml1.Strict.dfn
52div :: Markup2
53div = wrapMarkup2 Text.Blaze.XHtml1.Strict.div
54dl :: Markup2
55dl = wrapMarkup2 Text.Blaze.XHtml1.Strict.dl
56dt :: Markup2
57dt = wrapMarkup2 Text.Blaze.XHtml1.Strict.dt
58em :: Markup2
59em = wrapMarkup2 Text.Blaze.XHtml1.Strict.em
60fieldset :: Markup2
61fieldset = wrapMarkup2 Text.Blaze.XHtml1.Strict.fieldset
62form :: Markup2
63form = wrapMarkup2 Text.Blaze.XHtml1.Strict.form
64h1 :: Markup2
65h1 = wrapMarkup2 Text.Blaze.XHtml1.Strict.h1
66h2 :: Markup2
67h2 = wrapMarkup2 Text.Blaze.XHtml1.Strict.h2
68h3 :: Markup2
69h3 = wrapMarkup2 Text.Blaze.XHtml1.Strict.h3
70h4 :: Markup2
71h4 = wrapMarkup2 Text.Blaze.XHtml1.Strict.h4
72h5 :: Markup2
73h5 = wrapMarkup2 Text.Blaze.XHtml1.Strict.h5
74h6 :: Markup2
75h6 = wrapMarkup2 Text.Blaze.XHtml1.Strict.h6
76head :: Markup2
77head = wrapMarkup2 Text.Blaze.XHtml1.Strict.head
78html :: Markup2
79html = wrapMarkup2 Text.Blaze.XHtml1.Strict.html
80i :: Markup2
81i = wrapMarkup2 Text.Blaze.XHtml1.Strict.i
82ins :: Markup2
83ins = wrapMarkup2 Text.Blaze.XHtml1.Strict.ins
84kbd :: Markup2
85kbd = wrapMarkup2 Text.Blaze.XHtml1.Strict.kbd
86label :: Markup2
87label = wrapMarkup2 Text.Blaze.XHtml1.Strict.label
88legend :: Markup2
89legend = wrapMarkup2 Text.Blaze.XHtml1.Strict.legend
90li :: Markup2
91li = wrapMarkup2 Text.Blaze.XHtml1.Strict.li
92map :: Markup2
93map = wrapMarkup2 Text.Blaze.XHtml1.Strict.map
94noscript :: Markup2
95noscript = wrapMarkup2 Text.Blaze.XHtml1.Strict.noscript
96object :: Markup2
97object = wrapMarkup2 Text.Blaze.XHtml1.Strict.object
98ol :: Markup2
99ol = wrapMarkup2 Text.Blaze.XHtml1.Strict.ol
100optgroup :: Markup2
101optgroup = wrapMarkup2 Text.Blaze.XHtml1.Strict.optgroup
102option :: Markup2
103option = wrapMarkup2 Text.Blaze.XHtml1.Strict.option
104p :: Markup2
105p = wrapMarkup2 Text.Blaze.XHtml1.Strict.p
106pre :: Markup2
107pre = wrapMarkup2 Text.Blaze.XHtml1.Strict.pre
108q :: Markup2
109q = wrapMarkup2 Text.Blaze.XHtml1.Strict.q
110samp :: Markup2
111samp = wrapMarkup2 Text.Blaze.XHtml1.Strict.samp
112script :: Markup2
113script = wrapMarkup2 Text.Blaze.XHtml1.Strict.script
114select :: Markup2
115select = wrapMarkup2 Text.Blaze.XHtml1.Strict.select
116small :: Markup2
117small = wrapMarkup2 Text.Blaze.XHtml1.Strict.small
118span :: Markup2
119span = wrapMarkup2 Text.Blaze.XHtml1.Strict.span
120strong :: Markup2
121strong = wrapMarkup2 Text.Blaze.XHtml1.Strict.strong
122style :: Markup2
123style = wrapMarkup2 Text.Blaze.XHtml1.Strict.style
124sub :: Markup2
125sub = wrapMarkup2 Text.Blaze.XHtml1.Strict.sub
126sup :: Markup2
127sup = wrapMarkup2 Text.Blaze.XHtml1.Strict.sup
128table :: Markup2
129table = wrapMarkup2 Text.Blaze.XHtml1.Strict.table
130tbody :: Markup2
131tbody = wrapMarkup2 Text.Blaze.XHtml1.Strict.tbody
132td :: Markup2
133td = wrapMarkup2 Text.Blaze.XHtml1.Strict.td
134textarea :: Markup2
135textarea = wrapMarkup2 Text.Blaze.XHtml1.Strict.textarea
136tfoot :: Markup2
137tfoot = wrapMarkup2 Text.Blaze.XHtml1.Strict.tfoot
138th :: Markup2
139th = wrapMarkup2 Text.Blaze.XHtml1.Strict.th
140thead :: Markup2
141thead = wrapMarkup2 Text.Blaze.XHtml1.Strict.thead
142title :: Markup2
143title = wrapMarkup2 Text.Blaze.XHtml1.Strict.title
144tr :: Markup2
145tr = wrapMarkup2 Text.Blaze.XHtml1.Strict.tr
146tt :: Markup2
147tt = wrapMarkup2 Text.Blaze.XHtml1.Strict.tt
148ul :: Markup2
149ul = wrapMarkup2 Text.Blaze.XHtml1.Strict.ul
150var :: Markup2
151var = wrapMarkup2 Text.Blaze.XHtml1.Strict.var
152docType :: Markup
153docType = wrapMarkup Text.Blaze.XHtml1.Strict.docType
154area :: Markup
155area = wrapMarkup Text.Blaze.XHtml1.Strict.area
156br :: Markup
157br = wrapMarkup Text.Blaze.XHtml1.Strict.br
158col :: Markup
159col = wrapMarkup Text.Blaze.XHtml1.Strict.col
160hr :: Markup
161hr = wrapMarkup Text.Blaze.XHtml1.Strict.hr
162link :: Markup
163link = wrapMarkup Text.Blaze.XHtml1.Strict.link
164img :: Markup
165img = wrapMarkup Text.Blaze.XHtml1.Strict.img
166input :: Markup
167input = wrapMarkup Text.Blaze.XHtml1.Strict.input
168meta :: Markup
169meta = wrapMarkup Text.Blaze.XHtml1.Strict.meta
170param :: Markup
171param = wrapMarkup Text.Blaze.XHtml1.Strict.param
172
diff --git a/src/Text/BlazeT/XHtml1/Strict/Attributes.hs b/src/Text/BlazeT/XHtml1/Strict/Attributes.hs
new file mode 100644
index 0000000..c7e07d4
--- /dev/null
+++ b/src/Text/BlazeT/XHtml1/Strict/Attributes.hs
@@ -0,0 +1,11 @@
1-- !! DO NOT EDIT
2{-|
3(Automatically generated by @src\/Util\/GenerateHtmlTCombinators.hs:49@)
4
5This module simply reexports the corresponding @blaze-html@ module.
6-}
7module Text.BlazeT.XHtml1.Strict.Attributes
8 (module Text.Blaze.XHtml1.Strict.Attributes
9 ) where
10import Text.Blaze.XHtml1.Strict.Attributes
11
diff --git a/src/Text/BlazeT/XHtml1/Transitional.hs b/src/Text/BlazeT/XHtml1/Transitional.hs
new file mode 100644
index 0000000..b1e6aad
--- /dev/null
+++ b/src/Text/BlazeT/XHtml1/Transitional.hs
@@ -0,0 +1,194 @@
1-- !! DO NOT EDIT
2{-|
3(Automatically generated by @src\/Util\/GenerateHtmlTCombinators.hs:49@)
4
5This module wraps all exports of "Text.Blaze.XHtml1.Transitional" using 'wrapMarkup' and 'wrapMarkup'.
6-}
7module Text.BlazeT.XHtml1.Transitional
8 (module Text.BlazeT.XHtml1.Transitional
9 ,module Text.BlazeT.Html
10 ) where
11import qualified Text.Blaze.XHtml1.Transitional
12import Text.BlazeT
13import Text.BlazeT.Html
14import Text.BlazeT.Internal
15
16docTypeHtml :: Markup2
17docTypeHtml = wrapMarkup2 Text.Blaze.XHtml1.Transitional.docTypeHtml
18a :: Markup2
19a = wrapMarkup2 Text.Blaze.XHtml1.Transitional.a
20abbr :: Markup2
21abbr = wrapMarkup2 Text.Blaze.XHtml1.Transitional.abbr
22acronym :: Markup2
23acronym = wrapMarkup2 Text.Blaze.XHtml1.Transitional.acronym
24address :: Markup2
25address = wrapMarkup2 Text.Blaze.XHtml1.Transitional.address
26b :: Markup2
27b = wrapMarkup2 Text.Blaze.XHtml1.Transitional.b
28bdo :: Markup2
29bdo = wrapMarkup2 Text.Blaze.XHtml1.Transitional.bdo
30big :: Markup2
31big = wrapMarkup2 Text.Blaze.XHtml1.Transitional.big
32blockquote :: Markup2
33blockquote = wrapMarkup2 Text.Blaze.XHtml1.Transitional.blockquote
34body :: Markup2
35body = wrapMarkup2 Text.Blaze.XHtml1.Transitional.body
36button :: Markup2
37button = wrapMarkup2 Text.Blaze.XHtml1.Transitional.button
38caption :: Markup2
39caption = wrapMarkup2 Text.Blaze.XHtml1.Transitional.caption
40cite :: Markup2
41cite = wrapMarkup2 Text.Blaze.XHtml1.Transitional.cite
42code :: Markup2
43code = wrapMarkup2 Text.Blaze.XHtml1.Transitional.code
44colgroup :: Markup2
45colgroup = wrapMarkup2 Text.Blaze.XHtml1.Transitional.colgroup
46dd :: Markup2
47dd = wrapMarkup2 Text.Blaze.XHtml1.Transitional.dd
48del :: Markup2
49del = wrapMarkup2 Text.Blaze.XHtml1.Transitional.del
50dfn :: Markup2
51dfn = wrapMarkup2 Text.Blaze.XHtml1.Transitional.dfn
52div :: Markup2
53div = wrapMarkup2 Text.Blaze.XHtml1.Transitional.div
54dl :: Markup2
55dl = wrapMarkup2 Text.Blaze.XHtml1.Transitional.dl
56dt :: Markup2
57dt = wrapMarkup2 Text.Blaze.XHtml1.Transitional.dt
58em :: Markup2
59em = wrapMarkup2 Text.Blaze.XHtml1.Transitional.em
60fieldset :: Markup2
61fieldset = wrapMarkup2 Text.Blaze.XHtml1.Transitional.fieldset
62form :: Markup2
63form = wrapMarkup2 Text.Blaze.XHtml1.Transitional.form
64h1 :: Markup2
65h1 = wrapMarkup2 Text.Blaze.XHtml1.Transitional.h1
66h2 :: Markup2
67h2 = wrapMarkup2 Text.Blaze.XHtml1.Transitional.h2
68h3 :: Markup2
69h3 = wrapMarkup2 Text.Blaze.XHtml1.Transitional.h3
70h4 :: Markup2
71h4 = wrapMarkup2 Text.Blaze.XHtml1.Transitional.h4
72h5 :: Markup2
73h5 = wrapMarkup2 Text.Blaze.XHtml1.Transitional.h5
74h6 :: Markup2
75h6 = wrapMarkup2 Text.Blaze.XHtml1.Transitional.h6
76head :: Markup2
77head = wrapMarkup2 Text.Blaze.XHtml1.Transitional.head
78html :: Markup2
79html = wrapMarkup2 Text.Blaze.XHtml1.Transitional.html
80i :: Markup2
81i = wrapMarkup2 Text.Blaze.XHtml1.Transitional.i
82ins :: Markup2
83ins = wrapMarkup2 Text.Blaze.XHtml1.Transitional.ins
84kbd :: Markup2
85kbd = wrapMarkup2 Text.Blaze.XHtml1.Transitional.kbd
86label :: Markup2
87label = wrapMarkup2 Text.Blaze.XHtml1.Transitional.label
88legend :: Markup2
89legend = wrapMarkup2 Text.Blaze.XHtml1.Transitional.legend
90li :: Markup2
91li = wrapMarkup2 Text.Blaze.XHtml1.Transitional.li
92map :: Markup2
93map = wrapMarkup2 Text.Blaze.XHtml1.Transitional.map
94noscript :: Markup2
95noscript = wrapMarkup2 Text.Blaze.XHtml1.Transitional.noscript
96object :: Markup2
97object = wrapMarkup2 Text.Blaze.XHtml1.Transitional.object
98ol :: Markup2
99ol = wrapMarkup2 Text.Blaze.XHtml1.Transitional.ol
100optgroup :: Markup2
101optgroup = wrapMarkup2 Text.Blaze.XHtml1.Transitional.optgroup
102option :: Markup2
103option = wrapMarkup2 Text.Blaze.XHtml1.Transitional.option
104p :: Markup2
105p = wrapMarkup2 Text.Blaze.XHtml1.Transitional.p
106pre :: Markup2
107pre = wrapMarkup2 Text.Blaze.XHtml1.Transitional.pre
108q :: Markup2
109q = wrapMarkup2 Text.Blaze.XHtml1.Transitional.q
110samp :: Markup2
111samp = wrapMarkup2 Text.Blaze.XHtml1.Transitional.samp
112script :: Markup2
113script = wrapMarkup2 Text.Blaze.XHtml1.Transitional.script
114select :: Markup2
115select = wrapMarkup2 Text.Blaze.XHtml1.Transitional.select
116small :: Markup2
117small = wrapMarkup2 Text.Blaze.XHtml1.Transitional.small
118span :: Markup2
119span = wrapMarkup2 Text.Blaze.XHtml1.Transitional.span
120strong :: Markup2
121strong = wrapMarkup2 Text.Blaze.XHtml1.Transitional.strong
122style :: Markup2
123style = wrapMarkup2 Text.Blaze.XHtml1.Transitional.style
124sub :: Markup2
125sub = wrapMarkup2 Text.Blaze.XHtml1.Transitional.sub
126sup :: Markup2
127sup = wrapMarkup2 Text.Blaze.XHtml1.Transitional.sup
128table :: Markup2
129table = wrapMarkup2 Text.Blaze.XHtml1.Transitional.table
130tbody :: Markup2
131tbody = wrapMarkup2 Text.Blaze.XHtml1.Transitional.tbody
132td :: Markup2
133td = wrapMarkup2 Text.Blaze.XHtml1.Transitional.td
134textarea :: Markup2
135textarea = wrapMarkup2 Text.Blaze.XHtml1.Transitional.textarea
136tfoot :: Markup2
137tfoot = wrapMarkup2 Text.Blaze.XHtml1.Transitional.tfoot
138th :: Markup2
139th = wrapMarkup2 Text.Blaze.XHtml1.Transitional.th
140thead :: Markup2
141thead = wrapMarkup2 Text.Blaze.XHtml1.Transitional.thead
142title :: Markup2
143title = wrapMarkup2 Text.Blaze.XHtml1.Transitional.title
144tr :: Markup2
145tr = wrapMarkup2 Text.Blaze.XHtml1.Transitional.tr
146tt :: Markup2
147tt = wrapMarkup2 Text.Blaze.XHtml1.Transitional.tt
148ul :: Markup2
149ul = wrapMarkup2 Text.Blaze.XHtml1.Transitional.ul
150var :: Markup2
151var = wrapMarkup2 Text.Blaze.XHtml1.Transitional.var
152applet :: Markup2
153applet = wrapMarkup2 Text.Blaze.XHtml1.Transitional.applet
154center :: Markup2
155center = wrapMarkup2 Text.Blaze.XHtml1.Transitional.center
156dir :: Markup2
157dir = wrapMarkup2 Text.Blaze.XHtml1.Transitional.dir
158font :: Markup2
159font = wrapMarkup2 Text.Blaze.XHtml1.Transitional.font
160iframe :: Markup2
161iframe = wrapMarkup2 Text.Blaze.XHtml1.Transitional.iframe
162isindex :: Markup2
163isindex = wrapMarkup2 Text.Blaze.XHtml1.Transitional.isindex
164menu :: Markup2
165menu = wrapMarkup2 Text.Blaze.XHtml1.Transitional.menu
166noframes :: Markup2
167noframes = wrapMarkup2 Text.Blaze.XHtml1.Transitional.noframes
168s :: Markup2
169s = wrapMarkup2 Text.Blaze.XHtml1.Transitional.s
170u :: Markup2
171u = wrapMarkup2 Text.Blaze.XHtml1.Transitional.u
172docType :: Markup
173docType = wrapMarkup Text.Blaze.XHtml1.Transitional.docType
174area :: Markup
175area = wrapMarkup Text.Blaze.XHtml1.Transitional.area
176br :: Markup
177br = wrapMarkup Text.Blaze.XHtml1.Transitional.br
178col :: Markup
179col = wrapMarkup Text.Blaze.XHtml1.Transitional.col
180hr :: Markup
181hr = wrapMarkup Text.Blaze.XHtml1.Transitional.hr
182link :: Markup
183link = wrapMarkup Text.Blaze.XHtml1.Transitional.link
184img :: Markup
185img = wrapMarkup Text.Blaze.XHtml1.Transitional.img
186input :: Markup
187input = wrapMarkup Text.Blaze.XHtml1.Transitional.input
188meta :: Markup
189meta = wrapMarkup Text.Blaze.XHtml1.Transitional.meta
190param :: Markup
191param = wrapMarkup Text.Blaze.XHtml1.Transitional.param
192basefont :: Markup
193basefont = wrapMarkup Text.Blaze.XHtml1.Transitional.basefont
194
diff --git a/src/Text/BlazeT/XHtml1/Transitional/Attributes.hs b/src/Text/BlazeT/XHtml1/Transitional/Attributes.hs
new file mode 100644
index 0000000..1881806
--- /dev/null
+++ b/src/Text/BlazeT/XHtml1/Transitional/Attributes.hs
@@ -0,0 +1,11 @@
1-- !! DO NOT EDIT
2{-|
3(Automatically generated by @src\/Util\/GenerateHtmlTCombinators.hs:49@)
4
5This module simply reexports the corresponding @blaze-html@ module.
6-}
7module Text.BlazeT.XHtml1.Transitional.Attributes
8 (module Text.Blaze.XHtml1.Transitional.Attributes
9 ) where
10import Text.Blaze.XHtml1.Transitional.Attributes
11
diff --git a/src/Text/BlazeT/XHtml5.hs b/src/Text/BlazeT/XHtml5.hs
new file mode 100644
index 0000000..102a993
--- /dev/null
+++ b/src/Text/BlazeT/XHtml5.hs
@@ -0,0 +1,234 @@
1-- !! DO NOT EDIT
2{-|
3(Automatically generated by @src\/Util\/GenerateHtmlTCombinators.hs:49@)
4
5This module wraps all exports of "Text.Blaze.XHtml5" using 'wrapMarkup' and 'wrapMarkup'.
6-}
7module Text.BlazeT.XHtml5
8 (module Text.BlazeT.XHtml5
9 ,module Text.BlazeT.Html
10 ) where
11import qualified Text.Blaze.XHtml5
12import Text.BlazeT
13import Text.BlazeT.Html
14import Text.BlazeT.Internal
15
16docTypeHtml :: Markup2
17docTypeHtml = wrapMarkup2 Text.Blaze.XHtml5.docTypeHtml
18a :: Markup2
19a = wrapMarkup2 Text.Blaze.XHtml5.a
20abbr :: Markup2
21abbr = wrapMarkup2 Text.Blaze.XHtml5.abbr
22address :: Markup2
23address = wrapMarkup2 Text.Blaze.XHtml5.address
24article :: Markup2
25article = wrapMarkup2 Text.Blaze.XHtml5.article
26aside :: Markup2
27aside = wrapMarkup2 Text.Blaze.XHtml5.aside
28audio :: Markup2
29audio = wrapMarkup2 Text.Blaze.XHtml5.audio
30b :: Markup2
31b = wrapMarkup2 Text.Blaze.XHtml5.b
32bdo :: Markup2
33bdo = wrapMarkup2 Text.Blaze.XHtml5.bdo
34blockquote :: Markup2
35blockquote = wrapMarkup2 Text.Blaze.XHtml5.blockquote
36body :: Markup2
37body = wrapMarkup2 Text.Blaze.XHtml5.body
38button :: Markup2
39button = wrapMarkup2 Text.Blaze.XHtml5.button
40canvas :: Markup2
41canvas = wrapMarkup2 Text.Blaze.XHtml5.canvas
42caption :: Markup2
43caption = wrapMarkup2 Text.Blaze.XHtml5.caption
44cite :: Markup2
45cite = wrapMarkup2 Text.Blaze.XHtml5.cite
46code :: Markup2
47code = wrapMarkup2 Text.Blaze.XHtml5.code
48colgroup :: Markup2
49colgroup = wrapMarkup2 Text.Blaze.XHtml5.colgroup
50command :: Markup2
51command = wrapMarkup2 Text.Blaze.XHtml5.command
52datalist :: Markup2
53datalist = wrapMarkup2 Text.Blaze.XHtml5.datalist
54dd :: Markup2
55dd = wrapMarkup2 Text.Blaze.XHtml5.dd
56del :: Markup2
57del = wrapMarkup2 Text.Blaze.XHtml5.del
58details :: Markup2
59details = wrapMarkup2 Text.Blaze.XHtml5.details
60dfn :: Markup2
61dfn = wrapMarkup2 Text.Blaze.XHtml5.dfn
62div :: Markup2
63div = wrapMarkup2 Text.Blaze.XHtml5.div
64dl :: Markup2
65dl = wrapMarkup2 Text.Blaze.XHtml5.dl
66dt :: Markup2
67dt = wrapMarkup2 Text.Blaze.XHtml5.dt
68em :: Markup2
69em = wrapMarkup2 Text.Blaze.XHtml5.em
70fieldset :: Markup2
71fieldset = wrapMarkup2 Text.Blaze.XHtml5.fieldset
72figcaption :: Markup2
73figcaption = wrapMarkup2 Text.Blaze.XHtml5.figcaption
74figure :: Markup2
75figure = wrapMarkup2 Text.Blaze.XHtml5.figure
76footer :: Markup2
77footer = wrapMarkup2 Text.Blaze.XHtml5.footer
78form :: Markup2
79form = wrapMarkup2 Text.Blaze.XHtml5.form
80h1 :: Markup2
81h1 = wrapMarkup2 Text.Blaze.XHtml5.h1
82h2 :: Markup2
83h2 = wrapMarkup2 Text.Blaze.XHtml5.h2
84h3 :: Markup2
85h3 = wrapMarkup2 Text.Blaze.XHtml5.h3
86h4 :: Markup2
87h4 = wrapMarkup2 Text.Blaze.XHtml5.h4
88h5 :: Markup2
89h5 = wrapMarkup2 Text.Blaze.XHtml5.h5
90h6 :: Markup2
91h6 = wrapMarkup2 Text.Blaze.XHtml5.h6
92head :: Markup2
93head = wrapMarkup2 Text.Blaze.XHtml5.head
94header :: Markup2
95header = wrapMarkup2 Text.Blaze.XHtml5.header
96hgroup :: Markup2
97hgroup = wrapMarkup2 Text.Blaze.XHtml5.hgroup
98html :: Markup2
99html = wrapMarkup2 Text.Blaze.XHtml5.html
100i :: Markup2
101i = wrapMarkup2 Text.Blaze.XHtml5.i
102iframe :: Markup2
103iframe = wrapMarkup2 Text.Blaze.XHtml5.iframe
104ins :: Markup2
105ins = wrapMarkup2 Text.Blaze.XHtml5.ins
106kbd :: Markup2
107kbd = wrapMarkup2 Text.Blaze.XHtml5.kbd
108label :: Markup2
109label = wrapMarkup2 Text.Blaze.XHtml5.label
110legend :: Markup2
111legend = wrapMarkup2 Text.Blaze.XHtml5.legend
112li :: Markup2
113li = wrapMarkup2 Text.Blaze.XHtml5.li
114main :: Markup2
115main = wrapMarkup2 Text.Blaze.XHtml5.main
116map :: Markup2
117map = wrapMarkup2 Text.Blaze.XHtml5.map
118mark :: Markup2
119mark = wrapMarkup2 Text.Blaze.XHtml5.mark
120menu :: Markup2
121menu = wrapMarkup2 Text.Blaze.XHtml5.menu
122meter :: Markup2
123meter = wrapMarkup2 Text.Blaze.XHtml5.meter
124nav :: Markup2
125nav = wrapMarkup2 Text.Blaze.XHtml5.nav
126noscript :: Markup2
127noscript = wrapMarkup2 Text.Blaze.XHtml5.noscript
128object :: Markup2
129object = wrapMarkup2 Text.Blaze.XHtml5.object
130ol :: Markup2
131ol = wrapMarkup2 Text.Blaze.XHtml5.ol
132optgroup :: Markup2
133optgroup = wrapMarkup2 Text.Blaze.XHtml5.optgroup
134option :: Markup2
135option = wrapMarkup2 Text.Blaze.XHtml5.option
136output :: Markup2
137output = wrapMarkup2 Text.Blaze.XHtml5.output
138p :: Markup2
139p = wrapMarkup2 Text.Blaze.XHtml5.p
140pre :: Markup2
141pre = wrapMarkup2 Text.Blaze.XHtml5.pre
142progress :: Markup2
143progress = wrapMarkup2 Text.Blaze.XHtml5.progress
144q :: Markup2
145q = wrapMarkup2 Text.Blaze.XHtml5.q
146rp :: Markup2
147rp = wrapMarkup2 Text.Blaze.XHtml5.rp
148rt :: Markup2
149rt = wrapMarkup2 Text.Blaze.XHtml5.rt
150ruby :: Markup2
151ruby = wrapMarkup2 Text.Blaze.XHtml5.ruby
152samp :: Markup2
153samp = wrapMarkup2 Text.Blaze.XHtml5.samp
154script :: Markup2
155script = wrapMarkup2 Text.Blaze.XHtml5.script
156section :: Markup2
157section = wrapMarkup2 Text.Blaze.XHtml5.section
158select :: Markup2
159select = wrapMarkup2 Text.Blaze.XHtml5.select
160small :: Markup2
161small = wrapMarkup2 Text.Blaze.XHtml5.small
162span :: Markup2
163span = wrapMarkup2 Text.Blaze.XHtml5.span
164strong :: Markup2
165strong = wrapMarkup2 Text.Blaze.XHtml5.strong
166style :: Markup2
167style = wrapMarkup2 Text.Blaze.XHtml5.style
168sub :: Markup2
169sub = wrapMarkup2 Text.Blaze.XHtml5.sub
170summary :: Markup2
171summary = wrapMarkup2 Text.Blaze.XHtml5.summary
172sup :: Markup2
173sup = wrapMarkup2 Text.Blaze.XHtml5.sup
174table :: Markup2
175table = wrapMarkup2 Text.Blaze.XHtml5.table
176tbody :: Markup2
177tbody = wrapMarkup2 Text.Blaze.XHtml5.tbody
178td :: Markup2
179td = wrapMarkup2 Text.Blaze.XHtml5.td
180textarea :: Markup2
181textarea = wrapMarkup2 Text.Blaze.XHtml5.textarea
182tfoot :: Markup2
183tfoot = wrapMarkup2 Text.Blaze.XHtml5.tfoot
184th :: Markup2
185th = wrapMarkup2 Text.Blaze.XHtml5.th
186thead :: Markup2
187thead = wrapMarkup2 Text.Blaze.XHtml5.thead
188time :: Markup2
189time = wrapMarkup2 Text.Blaze.XHtml5.time
190title :: Markup2
191title = wrapMarkup2 Text.Blaze.XHtml5.title
192tr :: Markup2
193tr = wrapMarkup2 Text.Blaze.XHtml5.tr
194ul :: Markup2
195ul = wrapMarkup2 Text.Blaze.XHtml5.ul
196var :: Markup2
197var = wrapMarkup2 Text.Blaze.XHtml5.var
198video :: Markup2
199video = wrapMarkup2 Text.Blaze.XHtml5.video
200docType :: Markup
201docType = wrapMarkup Text.Blaze.XHtml5.docType
202area :: Markup
203area = wrapMarkup Text.Blaze.XHtml5.area
204base :: Markup
205base = wrapMarkup Text.Blaze.XHtml5.base
206br :: Markup
207br = wrapMarkup Text.Blaze.XHtml5.br
208col :: Markup
209col = wrapMarkup Text.Blaze.XHtml5.col
210embed :: Markup
211embed = wrapMarkup Text.Blaze.XHtml5.embed
212hr :: Markup
213hr = wrapMarkup Text.Blaze.XHtml5.hr
214img :: Markup
215img = wrapMarkup Text.Blaze.XHtml5.img
216input :: Markup
217input = wrapMarkup Text.Blaze.XHtml5.input
218keygen :: Markup
219keygen = wrapMarkup Text.Blaze.XHtml5.keygen
220link :: Markup
221link = wrapMarkup Text.Blaze.XHtml5.link
222menuitem :: Markup
223menuitem = wrapMarkup Text.Blaze.XHtml5.menuitem
224meta :: Markup
225meta = wrapMarkup Text.Blaze.XHtml5.meta
226param :: Markup
227param = wrapMarkup Text.Blaze.XHtml5.param
228source :: Markup
229source = wrapMarkup Text.Blaze.XHtml5.source
230track :: Markup
231track = wrapMarkup Text.Blaze.XHtml5.track
232wbr :: Markup
233wbr = wrapMarkup Text.Blaze.XHtml5.wbr
234
diff --git a/src/Text/BlazeT/XHtml5/Attributes.hs b/src/Text/BlazeT/XHtml5/Attributes.hs
new file mode 100644
index 0000000..e878108
--- /dev/null
+++ b/src/Text/BlazeT/XHtml5/Attributes.hs
@@ -0,0 +1,11 @@
1-- !! DO NOT EDIT
2{-|
3(Automatically generated by @src\/Util\/GenerateHtmlTCombinators.hs:49@)
4
5This module simply reexports the corresponding @blaze-html@ module.
6-}
7module Text.BlazeT.XHtml5.Attributes
8 (module Text.Blaze.XHtml5.Attributes
9 ) where
10import Text.Blaze.XHtml5.Attributes
11
diff --git a/src/Util/GenerateHtmlCombinators.hs b/src/Util/GenerateHtmlCombinators.hs
new file mode 100644
index 0000000..83da65b
--- /dev/null
+++ b/src/Util/GenerateHtmlCombinators.hs
@@ -0,0 +1,519 @@
1-- taken from https://github.com/jaspervdj/blaze-html/blob/2c4513e30ce768517b8d7b7b154d438f55217006/src/Util/GenerateHtmlCombinators.hs
2
3-- Copyright Jasper Van der Jeugt 2010
4
5-- All rights reserved.
6
7-- Redistribution and use in source and binary forms, with or without
8-- modification, are permitted provided that the following conditions are met:
9
10-- * Redistributions of source code must retain the above copyright
11-- notice, this list of conditions and the following disclaimer.
12
13-- * Redistributions in binary form must reproduce the above
14-- copyright notice, this list of conditions and the following
15-- disclaimer in the documentation and/or other materials provided
16-- with the distribution.
17
18-- * Neither the name of Jasper Van der Jeugt nor the names of other
19-- contributors may be used to endorse or promote products derived
20-- from this software without specific prior written permission.
21
22-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34{-# LANGUAGE CPP #-}
35
36#define DO_NOT_EDIT (doNotEdit __FILE__ __LINE__)
37
38-- | Generates code for HTML tags.
39--
40module Util.GenerateHtmlCombinators where
41
42import Control.Arrow ((&&&))
43import Data.List (sort, sortBy, intersperse, intercalate)
44import Data.Ord (comparing)
45import System.Directory (createDirectoryIfMissing)
46import System.FilePath ((</>), (<.>))
47import Data.Map (Map)
48import qualified Data.Map as M
49import Data.Char (toLower)
50import qualified Data.Set as S
51
52import Util.Sanitize (sanitize, prelude)
53
54-- | Datatype for an HTML variant.
55--
56data HtmlVariant = HtmlVariant
57 { version :: [String]
58 , docType :: [String]
59 , parents :: [String]
60 , leafs :: [String]
61 , attributes :: [String]
62 , selfClosing :: Bool
63 } deriving (Eq)
64
65instance Show HtmlVariant where
66 show = map toLower . intercalate "-" . version
67
68-- | Get the full module name for an HTML variant.
69--
70getModuleName :: HtmlVariant -> String
71getModuleName = ("Text.Blaze." ++) . intercalate "." . version
72
73-- | Get the attribute module name for an HTML variant.
74--
75getAttributeModuleName :: HtmlVariant -> String
76getAttributeModuleName = (++ ".Attributes") . getModuleName
77
78-- | Check if a given name causes a name clash.
79--
80isNameClash :: HtmlVariant -> String -> Bool
81isNameClash v t
82 -- Both an element and an attribute
83 | (t `elem` parents v || t `elem` leafs v) && t `elem` attributes v = True
84 -- Already a prelude function
85 | sanitize t `S.member` prelude = True
86 | otherwise = False
87
88-- | Write an HTML variant.
89--
90writeHtmlVariant :: HtmlVariant -> IO ()
91writeHtmlVariant htmlVariant = do
92 -- Make a directory.
93 createDirectoryIfMissing True basePath
94
95 let tags = zip parents' (repeat makeParent)
96 ++ zip leafs' (repeat (makeLeaf $ selfClosing htmlVariant))
97 sortedTags = sortBy (comparing fst) tags
98 appliedTags = map (\(x, f) -> f x) sortedTags
99
100 -- Write the main module.
101 writeFile' (basePath <.> "hs") $ removeTrailingNewlines $ unlines
102 [ DO_NOT_EDIT
103 , "{-# LANGUAGE OverloadedStrings #-}"
104 , "-- | This module exports HTML combinators used to create documents."
105 , "--"
106 , exportList modulName $ "module Text.Blaze.Html"
107 : "docType"
108 : "docTypeHtml"
109 : map (sanitize . fst) sortedTags
110 , DO_NOT_EDIT
111 , "import Prelude ((>>), (.))"
112 , ""
113 , "import Text.Blaze"
114 , "import Text.Blaze.Internal"
115 , "import Text.Blaze.Html"
116 , ""
117 , makeDocType $ docType htmlVariant
118 , makeDocTypeHtml $ docType htmlVariant
119 , unlines appliedTags
120 ]
121
122 let sortedAttributes = sort attributes'
123
124 -- Write the attribute module.
125 writeFile' (basePath </> "Attributes.hs") $ removeTrailingNewlines $ unlines
126 [ DO_NOT_EDIT
127 , "-- | This module exports combinators that provide you with the"
128 , "-- ability to set attributes on HTML elements."
129 , "--"
130 , "{-# LANGUAGE OverloadedStrings #-}"
131 , exportList attributeModuleName $ map sanitize sortedAttributes
132 , DO_NOT_EDIT
133 , "import Prelude ()"
134 , ""
135 , "import Text.Blaze.Internal (Attribute, AttributeValue, attribute)"
136 , ""
137 , unlines (map makeAttribute sortedAttributes)
138 ]
139 where
140 basePath = "src" </> "Text" </> "Blaze" </> foldl1 (</>) version'
141 modulName = getModuleName htmlVariant
142 attributeModuleName = getAttributeModuleName htmlVariant
143 attributes' = attributes htmlVariant
144 parents' = parents htmlVariant
145 leafs' = leafs htmlVariant
146 version' = version htmlVariant
147 removeTrailingNewlines = reverse . drop 2 . reverse
148 writeFile' file content = do
149 putStrLn ("Generating " ++ file)
150 writeFile file content
151
152-- | Create a string, consisting of @x@ spaces, where @x@ is the length of the
153-- argument.
154--
155spaces :: String -> String
156spaces = flip replicate ' ' . length
157
158-- | Join blocks of code with a newline in between.
159--
160unblocks :: [String] -> String
161unblocks = unlines . intersperse "\n"
162
163-- | A warning to not edit the generated code.
164--
165doNotEdit :: FilePath -> Int -> String
166doNotEdit fileName lineNumber = init $ unlines
167 [ "-- WARNING: The next block of code was automatically generated by"
168 , "-- " ++ fileName ++ ":" ++ show lineNumber
169 , "--"
170 ]
171
172-- | Generate an export list for a Haskell module.
173--
174exportList :: String -- ^ Module name.
175 -> [String] -- ^ List of functions.
176 -> String -- ^ Resulting string.
177exportList _ [] = error "exportList without functions."
178exportList name (f:functions) = unlines $
179 [ "module " ++ name
180 , " ( " ++ f
181 ] ++
182 map (" , " ++) functions ++
183 [ " ) where"]
184
185-- | Generate a function for a doctype.
186--
187makeDocType :: [String] -> String
188makeDocType lines' = unlines
189 [ DO_NOT_EDIT
190 , "-- | Combinator for the document type. This should be placed at the top"
191 , "-- of every HTML page."
192 , "--"
193 , "-- Example:"
194 , "--"
195 , "-- > docType"
196 , "--"
197 , "-- Result:"
198 , "--"
199 , unlines (map ("-- > " ++) lines') ++ "--"
200 , "docType :: Html -- ^ The document type HTML."
201 , "docType = preEscapedText " ++ show (unlines lines')
202 , "{-# INLINE docType #-}"
203 ]
204
205-- | Generate a function for the HTML tag (including the doctype).
206--
207makeDocTypeHtml :: [String] -- ^ The doctype.
208 -> String -- ^ Resulting combinator function.
209makeDocTypeHtml lines' = unlines
210 [ DO_NOT_EDIT
211 , "-- | Combinator for the @\\<html>@ element. This combinator will also"
212 , "-- insert the correct doctype."
213 , "--"
214 , "-- Example:"
215 , "--"
216 , "-- > docTypeHtml $ span $ toHtml \"foo\""
217 , "--"
218 , "-- Result:"
219 , "--"
220 , unlines (map ("-- > " ++) lines') ++ "-- > <html><span>foo</span></html>"
221 , "--"
222 , "docTypeHtml :: Html -- ^ Inner HTML."
223 , " -> Html -- ^ Resulting HTML."
224 , "docTypeHtml inner = docType >> html inner"
225 , "{-# INLINE docTypeHtml #-}"
226 ]
227
228-- | Generate a function for an HTML tag that can be a parent.
229--
230makeParent :: String -> String
231makeParent tag = unlines
232 [ DO_NOT_EDIT
233 , "-- | Combinator for the @\\<" ++ tag ++ ">@ element."
234 , "--"
235 , "-- Example:"
236 , "--"
237 , "-- > " ++ function ++ " $ span $ toHtml \"foo\""
238 , "--"
239 , "-- Result:"
240 , "--"
241 , "-- > <" ++ tag ++ "><span>foo</span></" ++ tag ++ ">"
242 , "--"
243 , function ++ " :: Html -- ^ Inner HTML."
244 , spaces function ++ " -> Html -- ^ Resulting HTML."
245 , function ++ " = Parent \"" ++ tag ++ "\" \"<" ++ tag
246 ++ "\" \"</" ++ tag ++ ">\"" ++ modifier
247 , "{-# INLINE " ++ function ++ " #-}"
248 ]
249 where
250 function = sanitize tag
251 modifier = if tag `elem` ["style", "script"] then " . external" else ""
252
253-- | Generate a function for an HTML tag that must be a leaf.
254--
255makeLeaf :: Bool -- ^ Make leaf tags self-closing
256 -> String -- ^ Tag for the combinator
257 -> String -- ^ Combinator code
258makeLeaf closing tag = unlines
259 [ DO_NOT_EDIT
260 , "-- | Combinator for the @\\<" ++ tag ++ " />@ element."
261 , "--"
262 , "-- Example:"
263 , "--"
264 , "-- > " ++ function
265 , "--"
266 , "-- Result:"
267 , "--"
268 , "-- > <" ++ tag ++ " />"
269 , "--"
270 , function ++ " :: Html -- ^ Resulting HTML."
271 , function ++ " = Leaf \"" ++ tag ++ "\" \"<" ++ tag ++ "\" " ++ "\""
272 ++ (if closing then " /" else "") ++ ">\""
273 , "{-# INLINE " ++ function ++ " #-}"
274 ]
275 where
276 function = sanitize tag
277
278-- | Generate a function for an HTML attribute.
279--
280makeAttribute :: String -> String
281makeAttribute name = unlines
282 [ DO_NOT_EDIT
283 , "-- | Combinator for the @" ++ name ++ "@ attribute."
284 , "--"
285 , "-- Example:"
286 , "--"
287 , "-- > div ! " ++ function ++ " \"bar\" $ \"Hello.\""
288 , "--"
289 , "-- Result:"
290 , "--"
291 , "-- > <div " ++ name ++ "=\"bar\">Hello.</div>"
292 , "--"
293 , function ++ " :: AttributeValue -- ^ Attribute value."
294 , spaces function ++ " -> Attribute -- ^ Resulting attribute."
295 , function ++ " = attribute \"" ++ name ++ "\" \" "
296 ++ name ++ "=\\\"\""
297 , "{-# INLINE " ++ function ++ " #-}"
298 ]
299 where
300 function = sanitize name
301
302-- | HTML 4.01 Strict.
303-- A good reference can be found here: http://www.w3schools.com/tags/default.asp
304--
305html4Strict :: HtmlVariant
306html4Strict = HtmlVariant
307 { version = ["Html4", "Strict"]
308 , docType =
309 [ "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\""
310 , " \"http://www.w3.org/TR/html4/strict.dtd\">"
311 ]
312 , parents =
313 [ "a", "abbr", "acronym", "address", "b", "bdo", "big", "blockquote"
314 , "body" , "button", "caption", "cite", "code", "colgroup", "dd", "del"
315 , "dfn", "div" , "dl", "dt", "em", "fieldset", "form", "h1", "h2", "h3"
316 , "h4", "h5", "h6", "head", "html", "i", "ins" , "kbd", "label"
317 , "legend", "li", "map", "noscript", "object", "ol", "optgroup"
318 , "option", "p", "pre", "q", "samp", "script", "select", "small"
319 , "span", "strong", "style", "sub", "sup", "table", "tbody", "td"
320 , "textarea", "tfoot", "th", "thead", "title", "tr", "tt", "ul", "var"
321 ]
322 , leafs =
323 [ "area", "br", "col", "hr", "link", "img", "input", "meta", "param"
324 ]
325 , attributes =
326 [ "abbr", "accept", "accesskey", "action", "align", "alt", "archive"
327 , "axis", "border", "cellpadding", "cellspacing", "char", "charoff"
328 , "charset", "checked", "cite", "class", "classid", "codebase"
329 , "codetype", "cols", "colspan", "content", "coords", "data", "datetime"
330 , "declare", "defer", "dir", "disabled", "enctype", "for", "frame"
331 , "headers", "height", "href", "hreflang", "http-equiv", "id", "label"
332 , "lang", "maxlength", "media", "method", "multiple", "name", "nohref"
333 , "onabort", "onblur", "onchange", "onclick", "ondblclick", "onfocus"
334 , "onkeydown", "onkeypress", "onkeyup", "onload", "onmousedown"
335 , "onmousemove", "onmouseout", "onmouseover", "onmouseup", "onreset"
336 , "onselect", "onsubmit", "onunload", "profile", "readonly", "rel"
337 , "rev", "rows", "rowspan", "rules", "scheme", "scope", "selected"
338 , "shape", "size", "span", "src", "standby", "style", "summary"
339 , "tabindex", "title", "type", "usemap", "valign", "value", "valuetype"
340 , "width"
341 ]
342 , selfClosing = False
343 }
344
345-- | HTML 4.0 Transitional
346--
347html4Transitional :: HtmlVariant
348html4Transitional = HtmlVariant
349 { version = ["Html4", "Transitional"]
350 , docType =
351 [ "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\""
352 , " \"http://www.w3.org/TR/html4/loose.dtd\">"
353 ]
354 , parents = parents html4Strict ++
355 [ "applet", "center", "dir", "font", "iframe", "isindex", "menu"
356 , "noframes", "s", "u"
357 ]
358 , leafs = leafs html4Strict ++ ["basefont"]
359 , attributes = attributes html4Strict ++
360 [ "background", "bgcolor", "clear", "compact", "hspace", "language"
361 , "noshade", "nowrap", "start", "target", "vspace"
362 ]
363 , selfClosing = False
364 }
365
366-- | HTML 4.0 FrameSet
367--
368html4FrameSet :: HtmlVariant
369html4FrameSet = HtmlVariant
370 { version = ["Html4", "FrameSet"]
371 , docType =
372 [ "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 FrameSet//EN\""
373 , " \"http://www.w3.org/TR/html4/frameset.dtd\">"
374 ]
375 , parents = parents html4Transitional ++ ["frameset"]
376 , leafs = leafs html4Transitional ++ ["frame"]
377 , attributes = attributes html4Transitional ++
378 [ "frameborder", "scrolling"
379 ]
380 , selfClosing = False
381 }
382
383-- | XHTML 1.0 Strict
384--
385xhtml1Strict :: HtmlVariant
386xhtml1Strict = HtmlVariant
387 { version = ["XHtml1", "Strict"]
388 , docType =
389 [ "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\""
390 , " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"
391 ]
392 , parents = parents html4Strict
393 , leafs = leafs html4Strict
394 , attributes = attributes html4Strict
395 , selfClosing = True
396 }
397
398-- | XHTML 1.0 Transitional
399--
400xhtml1Transitional :: HtmlVariant
401xhtml1Transitional = HtmlVariant
402 { version = ["XHtml1", "Transitional"]
403 , docType =
404 [ "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\""
405 , " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"
406 ]
407 , parents = parents html4Transitional
408 , leafs = leafs html4Transitional
409 , attributes = attributes html4Transitional
410 , selfClosing = True
411 }
412
413-- | XHTML 1.0 FrameSet
414--
415xhtml1FrameSet :: HtmlVariant
416xhtml1FrameSet = HtmlVariant
417 { version = ["XHtml1", "FrameSet"]
418 , docType =
419 [ "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 FrameSet//EN\""
420 , " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">"
421 ]
422 , parents = parents html4FrameSet
423 , leafs = leafs html4FrameSet
424 , attributes = attributes html4FrameSet
425 , selfClosing = True
426 }
427
428-- | HTML 5.0
429-- A good reference can be found here:
430-- http://www.w3schools.com/html5/html5_reference.asp
431--
432html5 :: HtmlVariant
433html5 = HtmlVariant
434 { version = ["Html5"]
435 , docType = ["<!DOCTYPE HTML>"]
436 , parents =
437 [ "a", "abbr", "address", "article", "aside", "audio", "b"
438 , "bdo", "blockquote", "body", "button", "canvas", "caption", "cite"
439 , "code", "colgroup", "command", "datalist", "dd", "del", "details"
440 , "dfn", "div", "dl", "dt", "em", "fieldset", "figcaption", "figure"
441 , "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header"
442 , "hgroup", "html", "i", "iframe", "ins", "kbd", "label"
443 , "legend", "li", "main", "map", "mark", "menu", "meter", "nav"
444 , "noscript", "object", "ol", "optgroup", "option", "output", "p"
445 , "pre", "progress", "q", "rp", "rt", "ruby", "samp", "script"
446 , "section", "select", "small", "span", "strong", "style", "sub"
447 , "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th"
448 , "thead", "time", "title", "tr", "ul", "var", "video"
449 ]
450 , leafs =
451 -- http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html#void-elements
452 [ "area", "base", "br", "col", "embed", "hr", "img", "input", "keygen"
453 , "link", "menuitem", "meta", "param", "source", "track", "wbr"
454 ]
455 , attributes =
456 [ "accept", "accept-charset", "accesskey", "action", "alt", "async"
457 , "autocomplete", "autofocus", "autoplay", "challenge", "charset"
458 , "checked", "cite", "class", "cols", "colspan", "content"
459 , "contenteditable", "contextmenu", "controls", "coords", "data"
460 , "datetime", "defer", "dir", "disabled", "draggable", "enctype", "for"
461 , "form", "formaction", "formenctype", "formmethod", "formnovalidate"
462 , "formtarget", "headers", "height", "hidden", "high", "href"
463 , "hreflang", "http-equiv", "icon", "id", "ismap", "item", "itemprop"
464 , "itemscope", "itemtype"
465 , "keytype", "label", "lang", "list", "loop", "low", "manifest", "max"
466 , "maxlength", "media", "method", "min", "multiple", "name"
467 , "novalidate", "onbeforeonload", "onbeforeprint", "onblur", "oncanplay"
468 , "oncanplaythrough", "onchange", "oncontextmenu", "onclick"
469 , "ondblclick", "ondrag", "ondragend", "ondragenter", "ondragleave"
470 , "ondragover", "ondragstart", "ondrop", "ondurationchange", "onemptied"
471 , "onended", "onerror", "onfocus", "onformchange", "onforminput"
472 , "onhaschange", "oninput", "oninvalid", "onkeydown", "onkeyup"
473 , "onload", "onloadeddata", "onloadedmetadata", "onloadstart"
474 , "onmessage", "onmousedown", "onmousemove", "onmouseout", "onmouseover"
475 , "onmouseup", "onmousewheel", "ononline", "onpagehide", "onpageshow"
476 , "onpause", "onplay", "onplaying", "onprogress", "onpropstate"
477 , "onratechange", "onreadystatechange", "onredo", "onresize", "onscroll"
478 , "onseeked", "onseeking", "onselect", "onstalled", "onstorage"
479 , "onsubmit", "onsuspend", "ontimeupdate", "onundo", "onunload"
480 , "onvolumechange", "onwaiting", "open", "optimum", "pattern", "ping"
481 , "placeholder", "preload", "pubdate", "radiogroup", "readonly", "rel"
482 , "required", "reversed", "rows", "rowspan", "sandbox", "scope"
483 , "scoped", "seamless", "selected", "shape", "size", "sizes", "span"
484 , "spellcheck", "src", "srcdoc", "start", "step", "style", "subject"
485 , "summary", "tabindex", "target", "title", "type", "usemap", "value"
486 , "width", "wrap", "xmlns"
487 ]
488 , selfClosing = False
489 }
490
491-- | XHTML 5.0
492--
493xhtml5 :: HtmlVariant
494xhtml5 = HtmlVariant
495 { version = ["XHtml5"]
496 , docType = ["<!DOCTYPE HTML>"]
497 , parents = parents html5
498 , leafs = leafs html5
499 , attributes = attributes html5
500 , selfClosing = True
501 }
502
503
504-- | A map of HTML variants, per version, lowercase.
505--
506htmlVariants :: Map String HtmlVariant
507htmlVariants = M.fromList $ map (show &&& id)
508 [ html4Strict
509 , html4Transitional
510 , html4FrameSet
511 , xhtml1Strict
512 , xhtml1Transitional
513 , xhtml1FrameSet
514 , html5
515 , xhtml5
516 ]
517
518main :: IO ()
519main = mapM_ (writeHtmlVariant . snd) $ M.toList htmlVariants
diff --git a/src/Util/GenerateHtmlTCombinators.hs b/src/Util/GenerateHtmlTCombinators.hs
new file mode 100755
index 0000000..0dd5444
--- /dev/null
+++ b/src/Util/GenerateHtmlTCombinators.hs
@@ -0,0 +1,62 @@
1{-# LANGUAGE CPP #-}
2
3module Util.GenerateHtmlTCombinators where
4
5import Control.Applicative
6import Data.List
7import Language.Haskell.TH
8import System.Directory
9import System.FilePath
10import Text.Printf
11import Text.Regex
12import Text.Regex.TDFA
13import Util.GenerateHtmlCombinators hiding (getModuleName, main)
14
15declare :: HtmlVariant -> [Dec]
16declare x = concatMap (\(w,ls) -> concatMap (g w) ls)
17 [(("wrapMarkup2","Markup2"),"docTypeHtml" : parents x)
18 ,(("wrapMarkup","Markup"), "docType" : leafs x)]
19 where g (w',t') l' =
20 [SigD l $ ConT t
21 ,ValD (VarP l) (NormalB (AppE (VarE w)
22 $ VarE $ mkName $ getModuleName "Blaze" x ++"."++l')) []]
23 where [w,t,l] = fmap mkName [w',t',l']
24
25
26
27writeSource :: HtmlVariant -> IO ()
28writeSource v = mapM_ g [True, False]
29 where
30 g attr = do
31 let path = if attr then "Attributes" else ""
32 name = (if attr then "." else "") ++ path
33 [mT,m] = ((++ name) . flip getModuleName v) <$>
34 ["BlazeT","Blaze"]
35 exports = if attr then [m] else [mT, "Text.BlazeT.Html"]
36 f = (joinPath $ ["src","Text","BlazeT"] ++ version v
37 ++ [path]) <.> "hs"
38 body = if attr then "" else unlines $
39 map (printf "import Text.BlazeT%s") ["", ".Html", ".Internal"]
40 ++ ["", show ( ppr_list $ declare v)]
41 quali = if attr then "" else "qualified "
42 docs True = "This module simply reexports the corresponding @blaze-html@ module."
43 docs False = printf "This module wraps all exports of \"%s\" using 'wrapMarkup' and 'wrapMarkup'." m
44 createDirectoryIfMissing True $ takeDirectory $ f
45 writeFile f $ unlines $
46 ["-- !! DO NOT EDIT"
47 ,"{-|"
48 ,printf "(Automatically generated by @%s:%d@)\n"
49 (subRegex (mkRegex "/") __FILE__ "\\\\/") ( __LINE__ :: Int)
50 ,docs attr
51 ,"-}"
52 ,"module "++ mT
53 ," (" ++ intercalate "\n ," (map ("module "++) exports)
54 ," ) where"
55 ,"import "++ quali ++ m
56 , body]
57
58main = mapM_ writeSource htmlVariants
59
60
61getModuleName :: String -> HtmlVariant -> String
62getModuleName base = (("Text."++base++".")++) . intercalate "." . version
diff --git a/src/Util/Sanitize.hs b/src/Util/Sanitize.hs
new file mode 100644
index 0000000..112bae1
--- /dev/null
+++ b/src/Util/Sanitize.hs
@@ -0,0 +1,112 @@
1-- taken from https://github.com/jaspervdj/blaze-html/blob/2c4513e30ce768517b8d7b7b154d438f55217006/src/Util/Sanitize.hs
2
3-- Copyright Jasper Van der Jeugt 2010
4
5-- All rights reserved.
6
7-- Redistribution and use in source and binary forms, with or without
8-- modification, are permitted provided that the following conditions are met:
9
10-- * Redistributions of source code must retain the above copyright
11-- notice, this list of conditions and the following disclaimer.
12
13-- * Redistributions in binary form must reproduce the above
14-- copyright notice, this list of conditions and the following
15-- disclaimer in the documentation and/or other materials provided
16-- with the distribution.
17
18-- * Neither the name of Jasper Van der Jeugt nor the names of other
19-- contributors may be used to endorse or promote products derived
20-- from this software without specific prior written permission.
21
22-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33-- | A program to sanitize an HTML tag to a Haskell function.
34--
35module Util.Sanitize
36 ( sanitize
37 , keywords
38 , prelude
39 ) where
40
41import Data.Char (toLower, toUpper)
42import Data.Set (Set)
43import qualified Data.Set as S
44
45-- | Sanitize a tag. This function returns a name that can be used as
46-- combinator in haskell source code.
47--
48-- Examples:
49--
50-- > sanitize "class" == "class_"
51-- > sanitize "http-equiv" == "httpEquiv"
52--
53sanitize :: String -> String
54sanitize str
55 | lower == "doctypehtml" = "docTypeHtml"
56 | otherwise = appendUnderscore $ removeDash lower
57 where
58 lower = map toLower str
59
60 -- Remove a dash, replacing it by camelcase notation
61 --
62 -- Example:
63 --
64 -- > removeDash "foo-bar" == "fooBar"
65 --
66 removeDash ('-' : x : xs) = toUpper x : removeDash xs
67 removeDash (x : xs) = x : removeDash xs
68 removeDash [] = []
69
70 appendUnderscore t | t `S.member` keywords = t ++ "_"
71 | otherwise = t
72
73-- | A set of standard Haskell keywords, which cannot be used as combinators.
74--
75keywords :: Set String
76keywords = S.fromList
77 [ "case", "class", "data", "default", "deriving", "do", "else", "if"
78 , "import", "in", "infix", "infixl", "infixr", "instance" , "let", "module"
79 , "newtype", "of", "then", "type", "where"
80 ]
81
82-- | Set of functions from the Prelude, which we do not use as combinators.
83--
84prelude :: Set String
85prelude = S.fromList
86 [ "abs", "acos", "acosh", "all", "and", "any", "appendFile", "asTypeOf"
87 , "asin", "asinh", "atan", "atan2", "atanh", "break", "catch", "ceiling"
88 , "compare", "concat", "concatMap", "const", "cos", "cosh", "curry", "cycle"
89 , "decodeFloat", "div", "divMod", "drop", "dropWhile", "either", "elem"
90 , "encodeFloat", "enumFrom", "enumFromThen", "enumFromThenTo", "enumFromTo"
91 , "error", "even", "exp", "exponent", "fail", "filter", "flip"
92 , "floatDigits", "floatRadix", "floatRange", "floor", "fmap", "foldl"
93 , "foldl1", "foldr", "foldr1", "fromEnum", "fromInteger", "fromIntegral"
94 , "fromRational", "fst", "gcd", "getChar", "getContents", "getLine", "head"
95 , "id", "init", "interact", "ioError", "isDenormalized", "isIEEE"
96 , "isInfinite", "isNaN", "isNegativeZero", "iterate", "last", "lcm"
97 , "length", "lex", "lines", "log", "logBase", "lookup", "map", "mapM"
98 , "mapM_", "max", "maxBound", "maximum", "maybe", "min", "minBound"
99 , "minimum", "mod", "negate", "not", "notElem", "null", "odd", "or"
100 , "otherwise", "pi", "pred", "print", "product", "properFraction", "putChar"
101 , "putStr", "putStrLn", "quot", "quotRem", "read", "readFile", "readIO"
102 , "readList", "readLn", "readParen", "reads", "readsPrec", "realToFrac"
103 , "recip", "rem", "repeat", "replicate", "return", "reverse", "round"
104 , "scaleFloat", "scanl", "scanl1", "scanr", "scanr1", "seq", "sequence"
105 , "sequence_", "show", "showChar", "showList", "showParen", "showString"
106 , "shows", "showsPrec", "significand", "signum", "sin", "sinh", "snd"
107 , "span", "splitAt", "sqrt", "subtract", "succ", "sum", "tail", "take"
108 , "takeWhile", "tan", "tanh", "toEnum", "toInteger", "toRational"
109 , "truncate", "uncurry", "undefined", "unlines", "until", "unwords", "unzip"
110 , "unzip3", "userError", "words", "writeFile", "zip", "zip3", "zipWith"
111 , "zipWith3"
112 ]