summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2013-01-20 15:51:23 +0100
committerJasper Van der Jeugt <m@jaspervdj.be>2013-01-20 15:51:23 +0100
commit87735f9778d759da7059a0e8d00c91e888a06673 (patch)
treeb2487715eed99beae0ad6be77a6af2d59267359c
parent064128305e5e1a99d20afa62331c7a3bdf566c8a (diff)
downloadhakyll-87735f9778d759da7059a0e8d00c91e888a06673.tar.gz
Fix issue with tagsoup renderTags
-rw-r--r--hakyll.cabal8
-rw-r--r--src/Hakyll/Web/Html.hs14
-rw-r--r--tests/Hakyll/Web/Html/Tests.hs4
-rw-r--r--web/releases.markdown7
4 files changed, 26 insertions, 7 deletions
diff --git a/hakyll.cabal b/hakyll.cabal
index 1af2122..3b808a1 100644
--- a/hakyll.cabal
+++ b/hakyll.cabal
@@ -1,5 +1,5 @@
Name: hakyll
-Version: 4.1.0.0
+Version: 4.1.1.0
Synopsis: A static website compiler library
Description:
@@ -176,9 +176,9 @@ Test-suite hakyll-tests
Build-Depends:
HUnit >= 1.2 && < 1.3,
QuickCheck >= 2.4 && < 2.6,
- test-framework >= 0.4 && < 0.7,
- test-framework-hunit >= 0.2 && < 0.3,
- test-framework-quickcheck2 >= 0.2 && < 0.3,
+ test-framework >= 0.4 && < 0.9,
+ test-framework-hunit >= 0.2 && < 0.4,
+ test-framework-quickcheck2 >= 0.2 && < 0.4,
-- Copy pasted from hakyll dependencies:
base >= 4 && < 5,
binary >= 0.5 && < 0.7,
diff --git a/src/Hakyll/Web/Html.hs b/src/Hakyll/Web/Html.hs
index 48482e6..4053003 100644
--- a/src/Hakyll/Web/Html.hs
+++ b/src/Hakyll/Web/Html.hs
@@ -24,6 +24,7 @@ module Hakyll.Web.Html
import Data.Char (digitToInt, intToDigit,
isDigit, toLower)
import Data.List (isPrefixOf)
+import qualified Data.Set as S
import System.FilePath (joinPath, splitPath,
takeDirectory)
import Text.Blaze.Html (toHtml)
@@ -71,13 +72,20 @@ withUrls f = withTags tag
attr (k, v) = (k, if isUrlAttribute k then f v else v)
--- | Customized TagSoup renderer. (The default TagSoup renderer escape CSS
--- within style tags.)
+--------------------------------------------------------------------------------
+-- | Customized TagSoup renderer. The default TagSoup renderer escape CSS
+-- within style tags, and doesn't properly minimize.
renderTags' :: [TS.Tag String] -> String
renderTags' = TS.renderTagsOptions TS.renderOptions
{ TS.optRawTag = (`elem` ["script", "style"]) . map toLower
- , TS.optMinimize = (`elem` ["br", "img"])
+ , TS.optMinimize = (`S.member` minimize) . map toLower
}
+ where
+ -- A list of elements which must be minimized
+ minimize = S.fromList
+ [ "area", "br", "col", "embed", "hr", "img", "input", "meta", "link"
+ , "param"
+ ]
--------------------------------------------------------------------------------
diff --git a/tests/Hakyll/Web/Html/Tests.hs b/tests/Hakyll/Web/Html/Tests.hs
index 35ffe27..1c17f5c 100644
--- a/tests/Hakyll/Web/Html/Tests.hs
+++ b/tests/Hakyll/Web/Html/Tests.hs
@@ -36,6 +36,10 @@ tests = testGroup "Hakyll.Web.Html.Tests" $ concat
withUrls id "<code>&lt;stdio&gt;</code>"
, "<style>body > p { line-height: 1.3 }</style>" @=?
withUrls id "<style>body > p { line-height: 1.3 }</style>"
+
+ -- Test minimizing elements
+ , "<meta bar=\"foo\" />" @=?
+ withUrls id "<meta bar=\"foo\" />"
]
, fromAssertions "toUrl"
diff --git a/web/releases.markdown b/web/releases.markdown
index 6ee53e1..8e1d4e8 100644
--- a/web/releases.markdown
+++ b/web/releases.markdown
@@ -2,6 +2,13 @@
title: Releases
---
+## Hakyll 4.1.1.0
+
+*January 20, 2013*
+
+- Fix an issue regarding `relativizeUrls` expanding `<meta />` to
+ `<meta></meta>`
+
## Hakyll 4.1.0.0
*January 20, 2013*