diff --git a/.travis.yml b/.travis.yml index 8774dc1..1fd16a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,9 +32,9 @@ before_cache: matrix: include: - - compiler: "ghc-8.6.2" + - compiler: "ghc-8.6.3" # env: TEST=--disable-tests BENCH=--disable-benchmarks - addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.6.2], sources: [hvr-ghc]}} + addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.6.3], sources: [hvr-ghc]}} - compiler: "ghc-8.4.4" # env: TEST=--disable-tests BENCH=--disable-benchmarks addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.4.4], sources: [hvr-ghc]}} @@ -44,12 +44,6 @@ matrix: - compiler: "ghc-8.0.2" # env: TEST=--disable-tests BENCH=--disable-benchmarks addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.0.2], sources: [hvr-ghc]}} - - compiler: "ghc-7.10.3" - # env: TEST=--disable-tests BENCH=--disable-benchmarks - addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-7.10.3], sources: [hvr-ghc]}} - - compiler: "ghc-7.8.4" - # env: TEST=--disable-tests BENCH=--disable-benchmarks - addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-7.8.4], sources: [hvr-ghc]}} before_install: - HC=${CC} @@ -75,6 +69,7 @@ install: - rm -fv cabal.project cabal.project.local - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$' - "printf 'packages: \".\"\\n' > cabal.project" + - "printf 'write-ghc-environment-files: always\\n' >> cabal.project" - touch cabal.project.local - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- servant-blaze | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi" - cat cabal.project || true @@ -97,6 +92,7 @@ script: - cd ${DISTDIR} || false - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \; - "printf 'packages: servant-blaze-*/*.cabal\\n' > cabal.project" + - "printf 'write-ghc-environment-files: always\\n' >> cabal.project" - touch cabal.project.local - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- servant-blaze | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi" - cat cabal.project || true @@ -120,15 +116,6 @@ script: # Constraint sets - rm -rf cabal.project.local - # Constraint set servant-0.7 - - if [ $HCNUMVER -ge 70800 ] && [ $HCNUMVER -lt 80000 ]; then cabal new-build -w ${HC} --disable-tests --disable-benchmarks --constraint='servant ==0.7.*' all; else echo skipping...; fi - - # Constraint set servant-0.8 - - if [ $HCNUMVER -ge 70800 ] && [ $HCNUMVER -lt 80200 ]; then cabal new-build -w ${HC} --disable-tests --disable-benchmarks --constraint='servant ==0.8.*' all; else echo skipping...; fi - - # Constraint set servant-0.9 - - if [ $HCNUMVER -ge 70800 ] && [ $HCNUMVER -lt 80200 ]; then cabal new-build -w ${HC} --disable-tests --disable-benchmarks --constraint='servant ==0.9.*' all; else echo skipping...; fi - # Constraint set servant-0.10 - if [ $HCNUMVER -ge 70800 ] && [ $HCNUMVER -lt 80200 ]; then cabal new-build -w ${HC} --disable-tests --disable-benchmarks --constraint='servant ==0.10.*' all; else echo skipping...; fi diff --git a/CHANGELOG.md b/CHANGELOG.md index ba856e5..1543b17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 0.9 + +- Also accept content type without character set i.e `text/html` +- Support only GHC >= 8.0 + # 0.8 - Only single `MimeRender HTML a` instance. `blaze-markup` has `ToMarkup Markup` instance. diff --git a/cabal.make-travis-yml b/cabal.make-travis-yml index a56581f..a1f3154 100644 --- a/cabal.make-travis-yml +++ b/cabal.make-travis-yml @@ -1,15 +1,3 @@ -constraint-set servant-0.7 - ghc: >= 7.8 && <8.0 - constraints: servant ==0.7.* - -constraint-set servant-0.8 - ghc: >= 7.8 && <8.2 - constraints: servant ==0.8.* - -constraint-set servant-0.9 - ghc: >= 7.8 && <8.2 - constraints: servant ==0.9.* - constraint-set servant-0.10 ghc: >= 7.8 && <8.2 constraints: servant ==0.10.* diff --git a/servant-blaze.cabal b/servant-blaze.cabal index 4b3aecb..48b18ad 100644 --- a/servant-blaze.cabal +++ b/servant-blaze.cabal @@ -1,7 +1,6 @@ cabal-version: >=1.10 name: servant-blaze -version: 0.8 -x-revision: 2 +version: 0.9 synopsis: Blaze-html support for servant category: Servant, Web @@ -19,12 +18,10 @@ maintainer: haskell-servant-maintainers@googlegroups.com copyright: 2015-2018 Servant Contributors build-type: Simple tested-with: - GHC ==7.8.4 - || ==7.10.3 - || ==8.0.2 + GHC ==8.0.2 || ==8.2.2 || ==8.4.4 - || ==8.6.2 + || ==8.6.3 source-repository head type: git @@ -32,8 +29,8 @@ source-repository head library exposed-modules: Servant.HTML.Blaze - build-depends: base >=4.7 && <5 - , servant >=0.7 && <0.16 + build-depends: base >=4.9 && <5 + , servant >=0.10 && <0.16 , http-media >=0.6.4 && <0.8 , blaze-html >=0.9.0.1 && <0.10 hs-source-dirs: src diff --git a/src/Servant/HTML/Blaze.hs b/src/Servant/HTML/Blaze.hs index 4e990c0..548a9e9 100644 --- a/src/Servant/HTML/Blaze.hs +++ b/src/Servant/HTML/Blaze.hs @@ -19,12 +19,15 @@ import qualified Network.HTTP.Media as M import Servant.API (Accept (..), MimeRender (..)) import Text.Blaze.Html (Html, ToMarkup, toHtml) import Text.Blaze.Html.Renderer.Utf8 (renderHtml) +import qualified Data.List.NonEmpty as NE data HTML deriving Typeable -- | @text/html;charset=utf-8@ instance Accept HTML where - contentType _ = "text" M.// "html" M./: ("charset", "utf-8") + contentTypes _ = + "text" M.// "html" M./: ("charset", "utf-8") NE.:| + ["text" M.// "html"] instance ToMarkup a => MimeRender HTML a where mimeRender _ = renderHtml . toHtml