on master help sign in
Minimize <img>, patch by Chris Mears
2caa185Jasper Van der Jeugt
src/Hakyll/Web/Urls.hs+2−1
@@ -29,7 +29,8 @@ withUrls f = renderTags' . map tag . TS.parseTags
29--
29--
30renderTags' :: [TS.Tag String] -> String
30renderTags' :: [TS.Tag String] -> String
31renderTags' = TS.renderTagsOptions TS.renderOptions
31renderTags' = TS.renderTagsOptions TS.renderOptions
32− { TS.optRawTag = (`elem` ["script", "style"]) . map toLower
32+ { TS.optRawTag = (`elem` ["script", "style"]) . map toLower
33+ , TS.optMinimize = (`elem` ["br", "img"])
33 }
34 }
34
35
35-- | Convert a filepath to an URL starting from the site root
36-- | Convert a filepath to an URL starting from the site root
tests/Hakyll/Web/Urls/Relativize/Tests.hs+1−2
@@ -9,7 +9,6 @@ module Hakyll.Web.Urls.Relativize.Tests
9import Test.Framework (Test, testGroup)
9import Test.Framework (Test, testGroup)
10import Test.HUnit ((@=?))
10import Test.HUnit ((@=?))
11
11
12−
13--------------------------------------------------------------------------------
12--------------------------------------------------------------------------------
14import Hakyll.Web.Urls.Relativize
13import Hakyll.Web.Urls.Relativize
15import TestSuite.Util
14import TestSuite.Util
@@ -21,7 +20,7 @@ tests = testGroup "Hakyll.Web.Urls.Relativize.Tests" $
21 fromAssertions "relativizeUrls"
20 fromAssertions "relativizeUrls"
22 [ "<a href=\"../foo\">bar</a>" @=?
21 [ "<a href=\"../foo\">bar</a>" @=?
23 relativizeUrlsWith ".." "<a href=\"/foo\">bar</a>"
22 relativizeUrlsWith ".." "<a href=\"/foo\">bar</a>"
24− , "<img src=\"../../images/lolcat.png\"></img>" @=?
23+ , "<img src=\"../../images/lolcat.png\" />" @=?
25 relativizeUrlsWith "../.." "<img src=\"/images/lolcat.png\" />"
24 relativizeUrlsWith "../.." "<img src=\"/images/lolcat.png\" />"
26 , "<a href=\"http://haskell.org\">Haskell</a>" @=?
25 , "<a href=\"http://haskell.org\">Haskell</a>" @=?
27 relativizeUrlsWith "../.."
26 relativizeUrlsWith "../.."
tests/Hakyll/Web/Urls/Tests.hs+2−2
@@ -21,8 +21,8 @@ tests = testGroup "Hakyll.Web.Urls.Tests" $ concat
21 [ fromAssertions "withUrls"
21 [ fromAssertions "withUrls"
22 [ "<a href=\"FOO\">bar</a>" @=?
22 [ "<a href=\"FOO\">bar</a>" @=?
23 withUrls (map toUpper) "<a href=\"foo\">bar</a>"
23 withUrls (map toUpper) "<a href=\"foo\">bar</a>"
24− , "<img src=\"OH BAR\">" @=?
24+ , "<img src=\"OH BAR\" />" @=?
25− withUrls (map toUpper) "<img src=\"oh bar\">"
25+ withUrls (map toUpper) "<img src=\"oh bar\" />"
26
26
27 -- Test escaping
27 -- Test escaping
28 , "<script>\"sup\"</script>" @=?
28 , "<script>\"sup\"</script>" @=?