hakyll 4.16.3.0 → 4.16.4.0
raw patch · 7 files changed
+69/−22 lines, 7 filesdep −blaze-markupdep −unordered-containersdep ~pandocdep ~randomPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies removed: blaze-markup, unordered-containers
Dependency ranges changed: pandoc, random
API changes (from Hackage documentation)
- Hakyll.Core.Configuration: instance Data.Default.Class.Default Hakyll.Core.Configuration.Configuration
+ Hakyll.Core.Configuration: instance Data.Default.Internal.Default Hakyll.Core.Configuration.Configuration
+ Hakyll.Web.Template.Context: boolFieldM :: String -> (Item a -> Compiler Bool) -> Context a
Files
- CHANGELOG.md +11/−0
- hakyll.cabal +5/−9
- lib/Hakyll/Check.hs +2/−1
- lib/Hakyll/Web/CompressCss.hs +12/−8
- lib/Hakyll/Web/Template/Context.hs +20/−3
- tests/Hakyll/Core/Identifier/Tests.hs +17/−1
- tests/Hakyll/Web/CompressCss/Tests.hs +2/−0
CHANGELOG.md view
@@ -4,6 +4,17 @@ # Releases +## Hakyll 4.16.4.0 (2024-12-08)++- Fixed an issue where compressing CSS with `clamp` expressions would + result in invalid CSS (#1021) (contribution by Laurent P. René de Cotret)+- Added `boolFieldM` (#1044) (contribution by 0xd34df00d)+- Run HLint as part of GitHub Actions (#1045) (contribution by Yoo Chung)+- Running the `check` command will now consider URLs that respond with a 3XX code+ (redirection) to be alive.+- Bump `data-default` upper bound to include 0.8+- Bump `pandoc` upper bound to include 3.6+ ## Hakyll 4.16.3.0 (2024-10-24) - Bump `pandoc` upper bound to include up to version 3.5
hakyll.cabal view
@@ -1,5 +1,5 @@ Name: hakyll-Version: 4.16.3.0+Version: 4.16.4.0 Synopsis: A static website compiler library Description:@@ -190,10 +190,9 @@ base >= 4.12 && < 5, binary >= 0.5 && < 0.10, blaze-html >= 0.5 && < 0.10,- blaze-markup >= 0.5.1 && < 0.9, bytestring >= 0.9 && < 0.13, containers >= 0.3 && < 0.8,- data-default >= 0.4 && < 0.8,+ data-default >= 0.4 && < 0.9, deepseq >= 1.3 && < 1.6, directory >= 1.2.7.0 && < 1.4, file-embed >= 0.0.10.1 && < 0.0.17,@@ -214,7 +213,6 @@ text >= 0.11 && < 1.3 || >= 2.0 && < 2.2, time >= 1.8 && < 1.15, time-locale-compat >= 0.1 && < 0.2,- unordered-containers >= 0.2 && < 0.3, vector >= 0.11 && < 0.14, wai-app-static >= 3.1 && < 3.2, yaml >= 0.8.11 && < 0.12@@ -254,7 +252,7 @@ Other-Modules: Hakyll.Web.Pandoc.Binary Build-Depends:- pandoc >= 2.11 && < 2.20 || >= 3.0 && < 3.6+ pandoc >= 2.11 && < 2.20 || >= 3.0 && < 3.7 Cpp-options: -DUSE_PANDOC @@ -298,8 +296,6 @@ containers >= 0.3 && < 0.8, filepath >= 1.0 && < 1.6, tagsoup >= 0.13.1 && < 0.15,- text >= 0.11 && < 1.3 || >= 2.0 && < 2.2,- unordered-containers >= 0.2 && < 0.3, yaml >= 0.8.11 && < 0.12 If flag(previewServer)@@ -321,7 +317,7 @@ Cpp-options: -DUSE_PANDOC Build-Depends:- pandoc >= 2.11 && < 2.20 || >= 3.0 && < 3.6+ pandoc >= 2.11 && < 2.20 || >= 3.0 && < 3.7 Executable hakyll-init@@ -355,4 +351,4 @@ base >= 4.12 && < 5, directory >= 1.0 && < 1.4, filepath >= 1.0 && < 1.6,- pandoc >= 2.11 && < 2.20 || >= 3.0 && < 3.6+ pandoc >= 2.11 && < 2.20 || >= 3.0 && < 3.7
lib/Hakyll/Check.hs view
@@ -259,7 +259,8 @@ request <- Http.parseRequest url response <- Http.http (settings request) mgr let code = Http.statusCode (Http.responseStatus response)- return $ code >= 200 && code < 300+ -- Recall that 3XX status codes are redirections, which aren't necessarily errors. + return $ code >= 200 && code < 400 where -- Add additional request info settings r = r
lib/Hakyll/Web/CompressCss.hs view
@@ -42,14 +42,17 @@ replaceAll " *[{};,>+~!] *" (take 1 . dropWhile isSpace) . replaceAll ": *" (take 1) -- not destroying pseudo selectors (#323) --- | Uses `compressCalcExpression` on all parenthesised calc expressions--- and applies `transform` to all parts outside of them+-- | Uses `compressExpression` on all parenthesised calc and +-- clamp expressions, and applies `transform` to all parts +-- outside of them handleCalcExpressions :: (String -> String) -> String -> String handleCalcExpressions transform = top transform where- top f "" = f ""- top f str | "calc(" `isPrefixOf` str = f "calc" ++ nested 0 compressCalcExpression (drop 4 str)- top f (x:xs) = top (f . (x:)) xs+ top f "" = f ""+ top f str | "calc(" `isPrefixOf` str = f "calc" ++ nested 0 compressExpression (drop 4 str)+ -- See issue #1021+ | "clamp(" `isPrefixOf` str = f "clamp" ++ nested 0 compressExpression (drop 5 str) + top f (x:xs) = top (f . (x:)) xs -- when called with depth=0, the first character must be a '(' nested :: Int -> (String -> String) -> String -> String@@ -62,9 +65,10 @@ _ -> depth ) (f . (x:)) xs --- | does not remove whitespace around + and -, which is important in calc() expressions-compressCalcExpression :: String -> String-compressCalcExpression =+-- | does not remove whitespace around + and -, which is important +-- in calc() and clamp() expressions+compressExpression :: String -> String+compressExpression = replaceAll " *[*/] *| *\\)|\\( *" (take 1 . dropWhile isSpace) --------------------------------------------------------------------------------
lib/Hakyll/Web/Template/Context.hs view
@@ -26,6 +26,7 @@ , Context (..) , field , boolField+ , boolFieldM , constField , listField , listFieldWith@@ -144,10 +145,26 @@ -- | Creates a 'field' to use with the @$if()$@ template macro. -- Attempting to substitute the field into the template will cause an error. boolField- :: String- -> (Item a -> Bool)+ :: String -- ^ Key+ -> (Item a -> Bool) -- ^ Extract value from an @'Item' a@ -> Context a-boolField name f = field' name (\i -> if f i+boolField name f = boolFieldM name (pure . f)+++--------------------------------------------------------------------------------+-- | Creates a 'field' to use with the @$if()$@ template macro, in the +-- 'Compiler' monad. Attempting to substitute the field into the template +-- will cause an error.+--+-- @since 4.16.4.0+boolFieldM+ :: String -- ^ Key+ -> (Item a -> Compiler Bool) -- ^ Extract value from an @'Item' a@ + -- from within the 'Compiler' monad+ -> Context a+boolFieldM name f = field' name (\i -> do+ b <- f i+ if b then return EmptyField else noResult $ "Field " ++ name ++ " is false")
tests/Hakyll/Core/Identifier/Tests.hs view
@@ -6,14 +6,16 @@ --------------------------------------------------------------------------------+import qualified Test.QuickCheck as Q import Test.Tasty (TestTree, testGroup) import Test.Tasty.HUnit ((@=?))+import Test.Tasty.QuickCheck (testProperty) -------------------------------------------------------------------------------- import Hakyll.Core.Identifier import Hakyll.Core.Identifier.Pattern-import System.FilePath ((</>))+import System.FilePath ((</>), isValid, equalFilePath, pathSeparators) import TestSuite.Util @@ -22,6 +24,7 @@ tests = testGroup "Hakyll.Core.Identifier.Tests" $ concat [ captureTests , matchesTests+ , [ testProperty "toFilePath . fromFilePath" filepathConversionProp ] ] @@ -59,3 +62,16 @@ , True @=? matches ("foo" .||. "bar") "bar" , False @=? matches ("bar" .&&. hasNoVersion) (setVersion (Just "xz") "bar") ]+++--------------------------------------------------------------------------------+-- Ensure that `fromFilePath` and `toFilePath` are inverses of each other (#791)+filepathConversionProp :: Q.Property+filepathConversionProp + = Q.forAll genFilePath + $ \fp -> toFilePath (fromFilePath fp) `equalFilePath` fp+ where+ genFilePath + = Q.listOf1 (Q.elements $ ['a'..'z'] <> pathSeparators) + `Q.suchThat` + isValid
tests/Hakyll/Web/CompressCss/Tests.hs view
@@ -43,6 +43,8 @@ , "a!b" @=? compressCss "a ! b" -- compress calc() , "calc(1px + 100%/(5 + 3) - (3px + 2px)*5)" @=? compressCss "calc( 1px + 100% / ( 5 + 3) - calc( 3px + 2px ) * 5 )"+ -- compress clamp() (issue #1021)+ , "clamp(2.25rem, 2vw + 1.5rem, 3.25rem)" @=? compressCss "clamp(2.25rem, 2vw + 1.5rem, 3.25rem)" -- compress whitespace even after this curly brace , "}" @=? compressCss "; } " -- but do not compress separators inside string tokens