hakyll 4.12.4.0 → 4.12.5.0
raw patch · 8 files changed
+75/−22 lines, 8 filesdep ~containersdep ~pandocdep ~pandoc-citeprocPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: containers, pandoc, pandoc-citeproc, tasty, yaml
API changes (from Hackage documentation)
- Hakyll.Core.Provider.Metadata: instance GHC.Exception.Exception Hakyll.Core.Provider.Metadata.MetadataException
+ Hakyll.Core.Provider.Metadata: instance GHC.Exception.Type.Exception Hakyll.Core.Provider.Metadata.MetadataException
+ Hakyll.Web.Feed: renderAtomWithTemplates :: String -> String -> FeedConfiguration -> Context String -> [Item String] -> Compiler (Item String)
+ Hakyll.Web.Feed: renderRssWithTemplates :: String -> String -> FeedConfiguration -> Context String -> [Item String] -> Compiler (Item String)
- Hakyll.Core.Compiler.Internal: Compiler :: CompilerRead -> IO (CompilerResult a) -> Compiler a
+ Hakyll.Core.Compiler.Internal: Compiler :: (CompilerRead -> IO (CompilerResult a)) -> Compiler a
- Hakyll.Core.Configuration: Configuration :: FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> Bool -> String -> Configuration -> IO ExitCode -> Bool -> String -> Int -> Configuration
+ Hakyll.Core.Configuration: Configuration :: FilePath -> FilePath -> FilePath -> FilePath -> (FilePath -> Bool) -> String -> (Configuration -> IO ExitCode) -> Bool -> String -> Int -> Configuration
- Hakyll.Core.Dependencies: PatternDependency :: Pattern -> (Set Identifier) -> Dependency
+ Hakyll.Core.Dependencies: PatternDependency :: Pattern -> Set Identifier -> Dependency
- Hakyll.Core.Identifier: fromFilePath :: String -> Identifier
+ Hakyll.Core.Identifier: fromFilePath :: FilePath -> Identifier
- Hakyll.Core.Rules: PatternDependency :: Pattern -> (Set Identifier) -> Dependency
+ Hakyll.Core.Rules: PatternDependency :: Pattern -> Set Identifier -> Dependency
- Hakyll.Web.Paginate: Paginate :: Map PageNumber [Identifier] -> PageNumber -> Identifier -> Dependency -> Paginate
+ Hakyll.Web.Paginate: Paginate :: Map PageNumber [Identifier] -> (PageNumber -> Identifier) -> Dependency -> Paginate
- Hakyll.Web.Pandoc.Biblio: readPandocBiblio :: ReaderOptions -> Item CSL -> Item Biblio -> (Item String) -> Compiler (Item Pandoc)
+ Hakyll.Web.Pandoc.Biblio: readPandocBiblio :: ReaderOptions -> Item CSL -> Item Biblio -> Item String -> Compiler (Item Pandoc)
- Hakyll.Web.Tags: Tags :: [(String, [Identifier])] -> String -> Identifier -> Dependency -> Tags
+ Hakyll.Web.Tags: Tags :: [(String, [Identifier])] -> (String -> Identifier) -> Dependency -> Tags
- Hakyll.Web.Tags: renderTagList :: Tags -> Compiler (String)
+ Hakyll.Web.Tags: renderTagList :: Tags -> Compiler String
- Hakyll.Web.Tags: tagsFieldWith :: (Identifier -> Compiler [String]) -> (String -> (Maybe FilePath) -> Maybe Html) -> ([Html] -> Html) -> String -> Tags -> Context a
+ Hakyll.Web.Tags: tagsFieldWith :: (Identifier -> Compiler [String]) -> (String -> Maybe FilePath -> Maybe Html) -> ([Html] -> Html) -> String -> Tags -> Context a
- Hakyll.Web.Template.Context: Context :: String -> [String] -> Item a -> Compiler ContextField -> Context a
+ Hakyll.Web.Template.Context: Context :: (String -> [String] -> Item a -> Compiler ContextField) -> Context a
- Hakyll.Web.Template.Context: ListField :: (Context a) -> [Item a] -> ContextField
+ Hakyll.Web.Template.Context: ListField :: Context a -> [Item a] -> ContextField
- Hakyll.Web.Template.Internal.Element: For :: TemplateExpr -> [TemplateElement] -> (Maybe [TemplateElement]) -> TemplateElement
+ Hakyll.Web.Template.Internal.Element: For :: TemplateExpr -> [TemplateElement] -> Maybe [TemplateElement] -> TemplateElement
- Hakyll.Web.Template.Internal.Element: If :: TemplateExpr -> [TemplateElement] -> (Maybe [TemplateElement]) -> TemplateElement
+ Hakyll.Web.Template.Internal.Element: If :: TemplateExpr -> [TemplateElement] -> Maybe [TemplateElement] -> TemplateElement
Files
- CHANGELOG.md +18/−0
- hakyll.cabal +9/−9
- lib/Hakyll/Core/Identifier.hs +1/−1
- lib/Hakyll/Core/Store.hs +6/−3
- lib/Hakyll/Web/Feed.hs +32/−6
- lib/Hakyll/Web/Template/Context.hs +2/−2
- tests/Hakyll/Core/UnixFilter/Tests.hs +3/−1
- tests/Hakyll/Web/Template/Context/Tests.hs +4/−0
CHANGELOG.md view
@@ -4,6 +4,24 @@ # Releases +## Hakyll 4.12.5.0 (2019-01-12)++- Update dependencies (contribution by Hexirp):+ * Bump containers to 0.6+ * Bump yaml to 0.11+ * Bump pandoc to 2.5+ * Bump pandoc-citeproc to 0.15+ * Bump tasty to 1.2+- Correct assertion in unixFilterError test+ (contribution by Jim McStanton)+- Add renderRssWithTemplates, renderAtomWithTemplates+ (contribution by Abhinav Sarkar)+- Speed up hashing in cache (contribution by 0xd34df00d)+- Update type of fromFilePath to use FilePath instead of String+ (contribution by Jim McStanton)+- Drop extension when parsing dates in filepaths (contribution by+ Gabriel Aumala)+ ## Hakyll 4.12.4.0 (2018-08-13) - Bump yaml to 0.10
hakyll.cabal view
@@ -1,5 +1,5 @@ Name: hakyll-Version: 4.12.4.0+Version: 4.12.5.0 Synopsis: A static website compiler library Description:@@ -166,7 +166,7 @@ blaze-html >= 0.5 && < 0.10, blaze-markup >= 0.5.1 && < 0.9, bytestring >= 0.9 && < 0.11,- containers >= 0.3 && < 0.6,+ containers >= 0.3 && < 0.7, cryptohash >= 0.7 && < 0.12, data-default >= 0.4 && < 0.8, deepseq >= 1.3 && < 1.5,@@ -187,7 +187,7 @@ time-locale-compat >= 0.1 && < 0.2, unordered-containers >= 0.2 && < 0.3, vector >= 0.11 && < 0.13,- yaml >= 0.8.11 && < 0.11,+ yaml >= 0.8.11 && < 0.12, optparse-applicative >= 0.12 && < 0.15, file-embed >= 0.0.10.1 && < 0.0.12 @@ -227,8 +227,8 @@ Other-Modules: Hakyll.Web.Pandoc.Binary Build-Depends:- pandoc >= 2.0.5 && < 2.3,- pandoc-citeproc >= 0.14 && < 0.15+ pandoc >= 2.0.5 && < 2.6,+ pandoc-citeproc >= 0.14 && < 0.16 Cpp-options: -DUSE_PANDOC @@ -260,17 +260,17 @@ Build-Depends: hakyll, QuickCheck >= 2.8 && < 2.13,- tasty >= 0.11 && < 1.2,+ tasty >= 0.11 && < 1.3, tasty-hunit >= 0.9 && < 0.11, tasty-quickcheck >= 0.8 && < 0.11, -- Copy pasted from hakyll dependencies: base >= 4.8 && < 5, bytestring >= 0.9 && < 0.11,- containers >= 0.3 && < 0.6,+ containers >= 0.3 && < 0.7, filepath >= 1.0 && < 1.5, text >= 0.11 && < 1.3, unordered-containers >= 0.2 && < 0.3,- yaml >= 0.8.11 && < 0.11+ yaml >= 0.8.11 && < 0.12 If flag(previewServer) Cpp-options:@@ -321,4 +321,4 @@ base >= 4 && < 5, directory >= 1.0 && < 1.4, filepath >= 1.0 && < 1.5,- pandoc >= 2.0.5 && < 2.3+ pandoc >= 2.0.5 && < 2.6
lib/Hakyll/Core/Identifier.hs view
@@ -62,7 +62,7 @@ -------------------------------------------------------------------------------- -- | Parse an identifier from a string-fromFilePath :: String -> Identifier+fromFilePath :: FilePath -> Identifier fromFilePath = Identifier Nothing . intercalate "/" . filter (not . null) . split' where
lib/Hakyll/Core/Store.hs view
@@ -27,11 +27,11 @@ import qualified Data.Text as T import qualified Data.Text.Encoding as T import Data.Typeable (TypeRep, Typeable, cast, typeOf)+import Numeric (showHex) import System.Directory (createDirectoryIfMissing) import System.Directory (doesFileExist, removeFile) import System.FilePath ((</>)) import System.IO (IOMode (..), hClose, openFile)-import Text.Printf (printf) --------------------------------------------------------------------------------@@ -193,5 +193,8 @@ -------------------------------------------------------------------------------- -- | Mostly meant for internal usage hash :: [String] -> String-hash = concatMap (printf "%02x") . B.unpack .- MD5.hash . T.encodeUtf8 . T.pack . intercalate "/"+hash = toHex . B.unpack . MD5.hash . T.encodeUtf8 . T.pack . intercalate "/"+ where+ toHex [] = ""+ toHex (x : xs) | x < 16 = '0' : showHex x (toHex xs)+ | otherwise = showHex x (toHex xs)
lib/Hakyll/Web/Feed.hs view
@@ -22,6 +22,8 @@ ( FeedConfiguration (..) , renderRss , renderAtom+ , renderRssWithTemplates+ , renderAtomWithTemplates ) where @@ -126,14 +128,40 @@ --------------------------------------------------------------------------------+-- | Render an RSS feed using given templates with a number of items.+renderRssWithTemplates ::+ String -- ^ Feed template+ -> String -- ^ Item template+ -> FeedConfiguration -- ^ Feed configuration+ -> Context String -- ^ Item context+ -> [Item String] -- ^ Feed items+ -> Compiler (Item String) -- ^ Resulting feed+renderRssWithTemplates feedTemplate itemTemplate config context = renderFeed+ feedTemplate itemTemplate config+ (makeItemContext "%a, %d %b %Y %H:%M:%S UT" context)+++--------------------------------------------------------------------------------+-- | Render an Atom feed using given templates with a number of items.+renderAtomWithTemplates ::+ String -- ^ Feed template+ -> String -- ^ Item template+ -> FeedConfiguration -- ^ Feed configuration+ -> Context String -- ^ Item context+ -> [Item String] -- ^ Feed items+ -> Compiler (Item String) -- ^ Resulting feed+renderAtomWithTemplates feedTemplate itemTemplate config context = renderFeed+ feedTemplate itemTemplate config+ (makeItemContext "%Y-%m-%dT%H:%M:%SZ" context)+++-------------------------------------------------------------------------------- -- | Render an RSS feed with a number of items. renderRss :: FeedConfiguration -- ^ Feed configuration -> Context String -- ^ Item context -> [Item String] -- ^ Feed items -> Compiler (Item String) -- ^ Resulting feed-renderRss config context = renderFeed- rssTemplate rssItemTemplate config- (makeItemContext "%a, %d %b %Y %H:%M:%S UT" context)+renderRss = renderRssWithTemplates rssTemplate rssItemTemplate --------------------------------------------------------------------------------@@ -142,9 +170,7 @@ -> Context String -- ^ Item context -> [Item String] -- ^ Feed items -> Compiler (Item String) -- ^ Resulting feed-renderAtom config context = renderFeed- atomTemplate atomItemTemplate config- (makeItemContext "%Y-%m-%dT%H:%M:%SZ" context)+renderAtom = renderAtomWithTemplates atomTemplate atomItemTemplate --------------------------------------------------------------------------------
lib/Hakyll/Web/Template/Context.hs view
@@ -50,7 +50,7 @@ import Hakyll.Core.Provider import Hakyll.Core.Util.String (needlePrefix, splitAll) import Hakyll.Web.Html-import System.FilePath (splitDirectories, takeBaseName)+import System.FilePath (splitDirectories, takeBaseName, dropExtension) --------------------------------------------------------------------------------@@ -300,7 +300,7 @@ getItemUTC locale id' = do metadata <- getMetadata id' let tryField k fmt = lookupString k metadata >>= parseTime' fmt- paths = splitDirectories $ toFilePath id'+ paths = splitDirectories $ (dropExtension . toFilePath) id' maybe empty' return $ msum $ [tryField "published" fmt | fmt <- formats] ++
tests/Hakyll/Core/UnixFilter/Tests.hs view
@@ -67,8 +67,10 @@ provider <- newTestProvider store result <- testCompiler store provider testMarkdown compiler case result of- CompilerError es -> True H.@=? any ("invalid option" `isInfixOf`) es+ CompilerError es -> True H.@=? any containsIncorrectOptionMessage es _ -> H.assertFailure "Expecting CompilerError" cleanTestEnv where compiler = getResourceString >>= withItemBody (unixFilter "head" ["-#"])+ incorrectOptionMessages = ["invalid option", "illegal option"]+ containsIncorrectOptionMessage output = any (`isInfixOf` output) incorrectOptionMessages
tests/Hakyll/Web/Template/Context/Tests.hs view
@@ -41,6 +41,10 @@ dateField "date" "%B %e, %Y" date2 @=? "August 26, 2010" + date3 <- testContextDone store provider+ "posts/2018-09-26.md" "date" $+ dateField "date" "%B %e, %Y"+ date3 @=? "September 26, 2018" cleanTestEnv