hakyll 4.2.1.2 → 4.2.2.0
raw patch · 5 files changed
+37/−19 lines, 5 filesdep +data-defaultPVP ok
version bump matches the API change (PVP)
Dependencies added: data-default
API changes (from Hackage documentation)
+ Hakyll.Core.Configuration: instance Default Configuration
Files
- hakyll.cabal +3/−1
- src/Hakyll/Core/Compiler/Internal.hs +3/−2
- src/Hakyll/Core/Configuration.hs +4/−0
- src/Hakyll/Web/Template/Context.hs +25/−13
- src/Hakyll/Web/Template/List.hs +2/−3
hakyll.cabal view
@@ -1,5 +1,5 @@ Name: hakyll-Version: 4.2.1.2+Version: 4.2.2.0 Synopsis: A static website compiler library Description:@@ -143,6 +143,7 @@ citeproc-hs >= 0.3.2 && < 0.4, containers >= 0.3 && < 0.6, cryptohash >= 0.7 && < 0.9,+ data-default >= 0.4 && < 0.6, deepseq >= 1.3 && < 1.4, directory >= 1.0 && < 1.3, filepath >= 1.0 && < 1.4,@@ -216,6 +217,7 @@ citeproc-hs >= 0.3.2 && < 0.4, containers >= 0.3 && < 0.6, cryptohash >= 0.7 && < 0.9,+ data-default >= 0.4 && < 0.6, deepseq >= 1.3 && < 1.4, directory >= 1.0 && < 1.3, filepath >= 1.0 && < 1.4,
src/Hakyll/Core/Compiler/Internal.hs view
@@ -183,8 +183,9 @@ compilerCatch (Compiler x) f = Compiler $ \r -> do res <- x r case res of- CompilerError e -> unCompiler (f e) r- _ -> return res+ CompilerDone res' w -> return (CompilerDone res' w)+ CompilerError e -> unCompiler (f e) r+ CompilerRequire i c -> return (CompilerRequire i (compilerCatch c f)) {-# INLINE compilerCatch #-}
src/Hakyll/Core/Configuration.hs view
@@ -8,6 +8,7 @@ --------------------------------------------------------------------------------+import Data.Default (Default(..)) import Data.List (isPrefixOf, isSuffixOf) import System.FilePath (normalise, takeFileName) @@ -56,6 +57,9 @@ inMemoryCache :: Bool } +--------------------------------------------------------------------------------+instance Default Configuration where+ def = defaultConfiguration -------------------------------------------------------------------------------- -- | Default configuration for a hakyll application
src/Hakyll/Web/Template/Context.hs view
@@ -127,23 +127,35 @@ -- | When the metadata has a field called @published@ in one of the -- following formats then this function can render the date. ----- * @Sun, 01 Feb 2000 13:00:00 UT@ (RSS date format)+-- * @Mon, 06 Sep 2010 00:01:00 +0000@ ----- * @2000-02-01T13:00:00Z@ (Atom date format)+-- * @Mon, 06 Sep 2010 00:01:00 UTC@ ----- * @February 1, 2000 1:00 PM@ (PM is usually uppercase)+-- * @Mon, 06 Sep 2010 00:01:00@ ----- * @February 1, 2000@ (assumes 12:00 AM for the time)+-- * @2010-09-06T00:01:00+0000@ --+-- * @2010-09-06T00:01:00Z@+--+-- * @2010-09-06T00:01:00@+--+-- * @2010-09-06 00:01:00+0000@+--+-- * @2010-09-06 00:01:00@+--+-- * @September 06, 2010 00:01 AM@+--+-- Following date-only formats are supported too (@00:00:00@ for time is+-- assumed)+--+-- * @2010-09-06@+--+-- * @September 06, 2010@+-- -- Alternatively, when the metadata has a field called @path@ in a -- @folder/yyyy-mm-dd-title.extension@ format (the convention for pages) -- and no @published@ metadata field set, this function can render -- the date.------ > renderDateField "date" "%B %e, %Y" "Date unknown"------ Will render something like @January 32, 2010@.--- dateField :: String -- ^ Key in which the rendered date should be placed -> String -- ^ Format to use on the date -> Context a -- ^ Resulting context@@ -165,7 +177,7 @@ -------------------------------------------------------------------------------- -- | Parser to try to extract and parse the time from the @published@--- field or from the filename. See 'renderDateField' for more information.+-- field or from the filename. See 'dateField' for more information. -- Exported for user convenience. getItemUTC :: MonadMetadata m => TimeLocale -- ^ Output time locale@@ -185,9 +197,9 @@ "could not parse time for " ++ show id' parseTime' = parseTime locale formats =- [ "%a, %d %b %Y %H:%M:%S UT"- , "%Y-%m-%dT%H:%M:%SZ"- , "%Y-%m-%d %H:%M:%S"+ [ "%a, %d %b %Y %H:%M:%S %Z"+ , "%Y-%m-%dT%H:%M:%S%Z"+ , "%Y-%m-%d %H:%M:%S%Z" , "%Y-%m-%d" , "%B %e, %Y %l:%M %p" , "%B %e, %Y"
src/Hakyll/Web/Template/List.hs view
@@ -55,9 +55,8 @@ ----------------------------------------------------------------------------------- | Sort pages chronologically. This function assumes that the pages have a--- @year-month-day-title.extension@ naming scheme -- as is the convention in--- Hakyll.+-- | Sort pages chronologically. Uses the same method as 'dateField' for+-- extracting the date. chronological :: MonadMetadata m => [Item a] -> m [Item a] chronological = sortByM $ getItemUTC defaultTimeLocale . itemIdentifier