on master help sign in
Fix issue with tagsoup renderTags
commit87735f9778d759da7059a0e8d00c91e888a06673 authorJasper Van der Jeugt <m@jaspervdj.be> dateSun 20 Jan 2013, 15:51 (14 years ago) parent0641283
4 files changed+26−7
hakyll.cabal+4−4 src/Hakyll/Web/Html.hs+11−3 tests/Hakyll/Web/Html/Tests.hs+4 web/releases.markdown+7
hakyll.cabal+4−4
@@ -1,5 +1,5 @@
11Name: hakyll
2−Version: 4.1.0.0
2+Version: 4.1.1.0
33
44Synopsis: A static website compiler library
55Description:
@@ -176,9 +176,9 @@ Test-suite hakyll-tests
176176 Build-Depends:
177177 HUnit >= 1.2 && < 1.3,
178178 QuickCheck >= 2.4 && < 2.6,
179− test-framework >= 0.4 && < 0.7,
180− test-framework-hunit >= 0.2 && < 0.3,
181− test-framework-quickcheck2 >= 0.2 && < 0.3,
179+ test-framework >= 0.4 && < 0.9,
180+ test-framework-hunit >= 0.2 && < 0.4,
181+ test-framework-quickcheck2 >= 0.2 && < 0.4,
182182 -- Copy pasted from hakyll dependencies:
183183 base >= 4 && < 5,
184184 binary >= 0.5 && < 0.7,
src/Hakyll/Web/Html.hs+11−3
@@ -24,6 +24,7 @@ module Hakyll.Web.Html
2424import Data.Char (digitToInt, intToDigit,
2525 isDigit, toLower)
2626import Data.List (isPrefixOf)
27+import qualified Data.Set as S
2728import System.FilePath (joinPath, splitPath,
2829 takeDirectory)
2930import Text.Blaze.Html (toHtml)
@@ -71,13 +72,20 @@ withUrls f = withTags tag
7172 attr (k, v) = (k, if isUrlAttribute k then f v else v)
7273
7374
74−-- | Customized TagSoup renderer. (The default TagSoup renderer escape CSS
75−-- within style tags.)
75+--------------------------------------------------------------------------------
76+-- | Customized TagSoup renderer. The default TagSoup renderer escape CSS
77+-- within style tags, and doesn't properly minimize.
7678renderTags' :: [TS.Tag String] -> String
7779renderTags' = TS.renderTagsOptions TS.renderOptions
7880 { TS.optRawTag = (`elem` ["script", "style"]) . map toLower
79− , TS.optMinimize = (`elem` ["br", "img"])
81+ , TS.optMinimize = (`S.member` minimize) . map toLower
8082 }
83+ where
84+ -- A list of elements which must be minimized
85+ minimize = S.fromList
86+ [ "area", "br", "col", "embed", "hr", "img", "input", "meta", "link"
87+ , "param"
88+ ]
8189
8290
8391--------------------------------------------------------------------------------
tests/Hakyll/Web/Html/Tests.hs+4
@@ -36,6 +36,10 @@ tests = testGroup "Hakyll.Web.Html.Tests" $ concat
3636 withUrls id "<code>&lt;stdio&gt;</code>"
3737 , "<style>body > p { line-height: 1.3 }</style>" @=?
3838 withUrls id "<style>body > p { line-height: 1.3 }</style>"
39+
40+ -- Test minimizing elements
41+ , "<meta bar=\"foo\" />" @=?
42+ withUrls id "<meta bar=\"foo\" />"
3943 ]
4044
4145 , fromAssertions "toUrl"
web/releases.markdown+7
@@ -2,6 +2,13 @@
22title: Releases
33---
44
5+## Hakyll 4.1.1.0
6+
7+*January 20, 2013*
8+
9+- Fix an issue regarding `relativizeUrls` expanding `<meta />` to
10+ `<meta></meta>`
11+
512## Hakyll 4.1.0.0
613
714*January 20, 2013*