Fix issue with tagsoup renderTags
This commit is contained in:
parent
064128305e
commit
87735f9778
4 changed files with 26 additions and 7 deletions
|
@ -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,
|
||||
|
|
|
@ -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"
|
||||
]
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
|
|
@ -36,6 +36,10 @@ tests = testGroup "Hakyll.Web.Html.Tests" $ concat
|
|||
withUrls id "<code><stdio></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"
|
||||
|
|
|
@ -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*
|
||||
|
|
Loading…
Reference in a new issue