diff options
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/package.yaml | 2 | ||||
-rw-r--r-- | compiler/src/Input.hs | 3 | ||||
-rw-r--r-- | compiler/src/Resource.hs | 6 | ||||
-rw-r--r-- | compiler/stack.yaml | 6 | ||||
-rw-r--r-- | compiler/stack.yaml.lock | 30 |
5 files changed, 5 insertions, 42 deletions
diff --git a/compiler/package.yaml b/compiler/package.yaml index fd44ccc..043985d 100644 --- a/compiler/package.yaml +++ b/compiler/package.yaml | |||
@@ -28,7 +28,7 @@ dependencies: | |||
28 | - parallel-io | 28 | - parallel-io |
29 | - Glob | 29 | - Glob |
30 | - safe | 30 | - safe |
31 | - time >= 1.9.3 && < 1.10 | 31 | - time |
32 | 32 | ||
33 | default-extensions: | 33 | default-extensions: |
34 | - DuplicateRecordFields | 34 | - DuplicateRecordFields |
diff --git a/compiler/src/Input.hs b/compiler/src/Input.hs index 86d3ec8..85c802e 100644 --- a/compiler/src/Input.hs +++ b/compiler/src/Input.hs | |||
@@ -30,6 +30,7 @@ import Data.Function ((&)) | |||
30 | import Data.Maybe (catMaybes) | 30 | import Data.Maybe (catMaybes) |
31 | import Data.Bool (bool) | 31 | import Data.Bool (bool) |
32 | import Data.List (find) | 32 | import Data.List (find) |
33 | import Data.Time.LocalTime (ZonedTime) | ||
33 | import Data.Yaml (ParseException, decodeFileEither) | 34 | import Data.Yaml (ParseException, decodeFileEither) |
34 | import Data.Aeson (FromJSON) | 35 | import Data.Aeson (FromJSON) |
35 | import System.FilePath (isExtensionOf, dropExtension) | 36 | import System.FilePath (isExtensionOf, dropExtension) |
@@ -60,7 +61,7 @@ data InputTree = | |||
60 | 61 | ||
61 | data Sidecar = Sidecar | 62 | data Sidecar = Sidecar |
62 | { title :: Maybe String | 63 | { title :: Maybe String |
63 | , date :: Maybe String | 64 | , date :: Maybe ZonedTime |
64 | , description :: Maybe String | 65 | , description :: Maybe String |
65 | , tags :: Maybe [String] | 66 | , tags :: Maybe [String] |
66 | } deriving (Generic, FromJSON, Show) | 67 | } deriving (Generic, FromJSON, Show) |
diff --git a/compiler/src/Resource.hs b/compiler/src/Resource.hs index 207239f..53d61ac 100644 --- a/compiler/src/Resource.hs +++ b/compiler/src/Resource.hs | |||
@@ -31,7 +31,6 @@ import Data.Maybe (mapMaybe, fromMaybe) | |||
31 | import Data.Function ((&)) | 31 | import Data.Function ((&)) |
32 | import qualified Data.Set as Set | 32 | import qualified Data.Set as Set |
33 | import Data.Time.LocalTime (ZonedTime, utc, utcToZonedTime, zonedTimeToUTC) | 33 | import Data.Time.LocalTime (ZonedTime, utc, utcToZonedTime, zonedTimeToUTC) |
34 | import Data.Time.Format.ISO8601 (iso8601ParseM) | ||
35 | import System.Directory (getModificationTime) | 34 | import System.Directory (getModificationTime) |
36 | import Safe.Foldable (maximumByMay) | 35 | import Safe.Foldable (maximumByMay) |
37 | 36 | ||
@@ -110,7 +109,7 @@ buildGalleryTree processItem processThumbnail tagsFromDirectories galleryName in | |||
110 | fileModTime <- lastModTime path | 109 | fileModTime <- lastModTime path |
111 | return GalleryItem | 110 | return GalleryItem |
112 | { title = itemTitle | 111 | { title = itemTitle |
113 | , date = fromMaybe fileModTime itemDate | 112 | , date = fromMaybe fileModTime $ Input.date sidecar |
114 | , description = optMeta description "" | 113 | , description = optMeta description "" |
115 | , tags = (optMeta tags []) ++ implicitParentTags parents | 114 | , tags = (optMeta tags []) ++ implicitParentTags parents |
116 | , path = parents </ itemTitle | 115 | , path = parents </ itemTitle |
@@ -120,9 +119,6 @@ buildGalleryTree processItem processThumbnail tagsFromDirectories galleryName in | |||
120 | itemTitle :: String | 119 | itemTitle :: String |
121 | itemTitle = optMeta title $ fromMaybe "" $ fileName path | 120 | itemTitle = optMeta title $ fromMaybe "" $ fileName path |
122 | 121 | ||
123 | itemDate :: Maybe ZonedTime | ||
124 | itemDate = Input.date sidecar >>= iso8601ParseM | ||
125 | |||
126 | optMeta :: (Sidecar -> Maybe a) -> a -> a | 122 | optMeta :: (Sidecar -> Maybe a) -> a -> a |
127 | optMeta get fallback = fromMaybe fallback $ get sidecar | 123 | optMeta get fallback = fromMaybe fallback $ get sidecar |
128 | 124 | ||
diff --git a/compiler/stack.yaml b/compiler/stack.yaml index 146f46b..29f8539 100644 --- a/compiler/stack.yaml +++ b/compiler/stack.yaml | |||
@@ -41,12 +41,6 @@ packages: | |||
41 | # | 41 | # |
42 | # extra-deps: [] | 42 | # extra-deps: [] |
43 | 43 | ||
44 | extra-deps: | ||
45 | - time-1.9.3@sha256:8f1b5448722a12a952248b356c9eb366e351226543d9086a2da71270522d5f45,5679 | ||
46 | - directory-1.3.4.0@sha256:500019f04494324d1df16cf83eefeb3f809b2b20b32a32ccd755ee0439c18bfd,2829 | ||
47 | - process-1.6.7.0@sha256:305bcf44c42a96425e77af1748183f505a701648f68cc299d5ad8ac1b866a6a1,2468 | ||
48 | - unix-2.7.2.2@sha256:e69269a17b9fa26cb77f3f55e86c39d0a4940ccfa0c4bc20826919d2572076ad,3496 | ||
49 | |||
50 | # Override default flag values for local packages and extra-deps | 44 | # Override default flag values for local packages and extra-deps |
51 | # flags: {} | 45 | # flags: {} |
52 | 46 | ||
diff --git a/compiler/stack.yaml.lock b/compiler/stack.yaml.lock index 8e833c5..fc538c1 100644 --- a/compiler/stack.yaml.lock +++ b/compiler/stack.yaml.lock | |||
@@ -3,35 +3,7 @@ | |||
3 | # For more information, please see the documentation at: | 3 | # For more information, please see the documentation at: |
4 | # https://docs.haskellstack.org/en/stable/lock_files | 4 | # https://docs.haskellstack.org/en/stable/lock_files |
5 | 5 | ||
6 | packages: | 6 | packages: [] |
7 | - completed: | ||
8 | hackage: time-1.9.3@sha256:8f1b5448722a12a952248b356c9eb366e351226543d9086a2da71270522d5f45,5679 | ||
9 | pantry-tree: | ||
10 | size: 6558 | ||
11 | sha256: a1043c1719491764f0fa37a1fd70d9451080548a41632fee88d8e1b8db4942d6 | ||
12 | original: | ||
13 | hackage: time-1.9.3@sha256:8f1b5448722a12a952248b356c9eb366e351226543d9086a2da71270522d5f45,5679 | ||
14 | - completed: | ||
15 | hackage: directory-1.3.4.0@sha256:500019f04494324d1df16cf83eefeb3f809b2b20b32a32ccd755ee0439c18bfd,2829 | ||
16 | pantry-tree: | ||
17 | size: 3365 | ||
18 | sha256: 00c09e0c014d29ebfb921b64c1459e61a0ad6f10e70128d795246a47c06394b0 | ||
19 | original: | ||
20 | hackage: directory-1.3.4.0@sha256:500019f04494324d1df16cf83eefeb3f809b2b20b32a32ccd755ee0439c18bfd,2829 | ||
21 | - completed: | ||
22 | hackage: process-1.6.7.0@sha256:305bcf44c42a96425e77af1748183f505a701648f68cc299d5ad8ac1b866a6a1,2468 | ||
23 | pantry-tree: | ||
24 | size: 1211 | ||
25 | sha256: 49c3e531d2473fe455c1cde655f074a320fa4ec8569d650262bf382f9c5796fb | ||
26 | original: | ||
27 | hackage: process-1.6.7.0@sha256:305bcf44c42a96425e77af1748183f505a701648f68cc299d5ad8ac1b866a6a1,2468 | ||
28 | - completed: | ||
29 | hackage: unix-2.7.2.2@sha256:e69269a17b9fa26cb77f3f55e86c39d0a4940ccfa0c4bc20826919d2572076ad,3496 | ||
30 | pantry-tree: | ||
31 | size: 3536 | ||
32 | sha256: c355f7924ce67e5bf8f20767462af18f09b8c0d1f7161117221cbb94c15deee3 | ||
33 | original: | ||
34 | hackage: unix-2.7.2.2@sha256:e69269a17b9fa26cb77f3f55e86c39d0a4940ccfa0c4bc20826919d2572076ad,3496 | ||
35 | snapshots: | 7 | snapshots: |
36 | - completed: | 8 | - completed: |
37 | size: 524799 | 9 | size: 524799 |