summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2015-08-02 15:01:16 +0200
committerJasper Van der Jeugt <jaspervdj@gmail.com>2015-08-02 15:01:16 +0200
commitd8a3d7e929881793bd4cd214085d1670524dd6c6 (patch)
treed730db9fb20813508028424185d4a5dcf865c070
parentdf2bc9fa9e244f77a3fce8591da45ce51dc3005c (diff)
parent0e2083a5af2e75f3d2680334d935a606e4785851 (diff)
downloadhakyll-d8a3d7e929881793bd4cd214085d1670524dd6c6.tar.gz
Merge pull request #360 from bergmark/time-1.4
Allow time 1.4.*
-rw-r--r--hakyll.cabal53
-rw-r--r--src/Hakyll/Web/Template/Context.hs14
-rw-r--r--src/Hakyll/Web/Template/List.hs2
3 files changed, 39 insertions, 30 deletions
diff --git a/hakyll.cabal b/hakyll.cabal
index c048236..7841e06 100644
--- a/hakyll.cabal
+++ b/hakyll.cabal
@@ -140,32 +140,33 @@ Library
Paths_hakyll
Build-Depends:
- base >= 4 && < 5,
- binary >= 0.5 && < 0.8,
- blaze-html >= 0.5 && < 0.9,
- blaze-markup >= 0.5.1 && < 0.8,
- bytestring >= 0.9 && < 0.11,
- cmdargs >= 0.10 && < 0.11,
- containers >= 0.3 && < 0.6,
- cryptohash >= 0.7 && < 0.12,
- data-default >= 0.4 && < 0.6,
- deepseq >= 1.3 && < 1.5,
- directory >= 1.0 && < 1.3,
- filepath >= 1.0 && < 1.5,
- lrucache >= 1.1.1 && < 1.3,
- mtl >= 1 && < 2.3,
- network >= 2.6 && < 2.7,
- network-uri >= 2.6 && < 2.7,
- pandoc >= 1.14 && < 1.16,
- pandoc-citeproc >= 0.4 && < 0.8,
- parsec >= 3.0 && < 3.2,
- process >= 1.0 && < 1.3,
- random >= 1.0 && < 1.2,
- regex-base >= 0.93 && < 0.94,
- regex-tdfa >= 1.1 && < 1.3,
- tagsoup >= 0.13.1 && < 0.14,
- text >= 0.11 && < 1.3,
- time >= 1.5 && < 1.6
+ base >= 4 && < 5,
+ binary >= 0.5 && < 0.8,
+ blaze-html >= 0.5 && < 0.9,
+ blaze-markup >= 0.5.1 && < 0.8,
+ bytestring >= 0.9 && < 0.11,
+ cmdargs >= 0.10 && < 0.11,
+ containers >= 0.3 && < 0.6,
+ cryptohash >= 0.7 && < 0.12,
+ data-default >= 0.4 && < 0.6,
+ deepseq >= 1.3 && < 1.5,
+ directory >= 1.0 && < 1.3,
+ filepath >= 1.0 && < 1.5,
+ lrucache >= 1.1.1 && < 1.3,
+ mtl >= 1 && < 2.3,
+ network >= 2.6 && < 2.7,
+ network-uri >= 2.6 && < 2.7,
+ pandoc >= 1.14 && < 1.16,
+ pandoc-citeproc >= 0.4 && < 0.8,
+ parsec >= 3.0 && < 3.2,
+ process >= 1.0 && < 1.3,
+ random >= 1.0 && < 1.2,
+ regex-base >= 0.93 && < 0.94,
+ regex-tdfa >= 1.1 && < 1.3,
+ tagsoup >= 0.13.1 && < 0.14,
+ text >= 0.11 && < 1.3,
+ time >= 1.4 && < 1.6,
+ time-locale-compat >= 0.1 && < 0.2
If flag(previewServer)
Build-depends:
diff --git a/src/Hakyll/Web/Template/Context.hs b/src/Hakyll/Web/Template/Context.hs
index 080f819..43857ff 100644
--- a/src/Hakyll/Web/Template/Context.hs
+++ b/src/Hakyll/Web/Template/Context.hs
@@ -1,4 +1,5 @@
--------------------------------------------------------------------------------
+{-# LANGUAGE CPP #-}
{-# LANGUAGE ExistentialQuantification #-}
module Hakyll.Web.Template.Context
( ContextField (..)
@@ -35,11 +36,11 @@ import Data.List (intercalate)
import qualified Data.Map as M
import Data.Monoid (Monoid (..))
import Data.Time.Clock (UTCTime (..))
-import Data.Time.Format (TimeLocale, defaultTimeLocale,
- formatTime, parseTimeM)
+import Data.Time.Format (formatTime)
+import qualified Data.Time.Format as TF
+import Data.Time.Locale.Compat (TimeLocale, defaultTimeLocale)
import System.FilePath (splitDirectories, takeBaseName)
-
--------------------------------------------------------------------------------
import Hakyll.Core.Compiler
import Hakyll.Core.Compiler.Internal
@@ -345,3 +346,10 @@ missingField :: Context a
missingField = Context $ \k _ i -> fail $
"Missing field $" ++ k ++ "$ in context for item " ++
show (itemIdentifier i)
+
+parseTimeM :: Bool -> TimeLocale -> String -> String -> Maybe UTCTime
+#if MIN_VERSION_time(1,5,0)
+parseTimeM = TF.parseTimeM
+#else
+parseTimeM _ = TF.parseTime
+#endif
diff --git a/src/Hakyll/Web/Template/List.hs b/src/Hakyll/Web/Template/List.hs
index b44e3b1..4d769fc 100644
--- a/src/Hakyll/Web/Template/List.hs
+++ b/src/Hakyll/Web/Template/List.hs
@@ -22,7 +22,7 @@ module Hakyll.Web.Template.List
import Control.Monad (liftM)
import Data.List (intersperse, sortBy)
import Data.Ord (comparing)
-import Data.Time.Format (defaultTimeLocale)
+import Data.Time.Locale.Compat (defaultTimeLocale)
--------------------------------------------------------------------------------