aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpacien2020-01-06 11:05:18 +0100
committerpacien2020-01-06 11:05:18 +0100
commitf1ffff03ad6bf86c32c3af90393bd53ca21ad4db (patch)
treeefbd39895ded4d48fdc86d4fa932a15afb943e64
parent03d39102ba55cda7cbe80fcdeb9b250caaa70bd0 (diff)
downloadldgallery-f1ffff03ad6bf86c32c3af90393bd53ca21ad4db.tar.gz
compiler: rename date field to more explicit datetime
-rw-r--r--compiler/src/Input.hs4
-rw-r--r--compiler/src/Resource.hs12
-rw-r--r--example/Glacier 3000/_DSC5475.jpg.yaml2
-rw-r--r--example/Glacier 3000/_DSC5542.jpg.yaml2
-rw-r--r--example/_DSC8808-1.jpg.yaml2
-rw-r--r--ldgallery.1.md2
6 files changed, 12 insertions, 12 deletions
diff --git a/compiler/src/Input.hs b/compiler/src/Input.hs
index 85c802e..95d8132 100644
--- a/compiler/src/Input.hs
+++ b/compiler/src/Input.hs
@@ -61,7 +61,7 @@ data InputTree =
61 61
62data Sidecar = Sidecar 62data Sidecar = Sidecar
63 { title :: Maybe String 63 { title :: Maybe String
64 , date :: Maybe ZonedTime 64 , datetime :: Maybe ZonedTime
65 , description :: Maybe String 65 , description :: Maybe String
66 , tags :: Maybe [String] 66 , tags :: Maybe [String]
67 } deriving (Generic, FromJSON, Show) 67 } deriving (Generic, FromJSON, Show)
@@ -69,7 +69,7 @@ data Sidecar = Sidecar
69emptySidecar :: Sidecar 69emptySidecar :: Sidecar
70emptySidecar = Sidecar 70emptySidecar = Sidecar
71 { title = Nothing 71 { title = Nothing
72 , date = Nothing 72 , datetime = Nothing
73 , description = Nothing 73 , description = Nothing
74 , tags = Nothing } 74 , tags = Nothing }
75 75
diff --git a/compiler/src/Resource.hs b/compiler/src/Resource.hs
index 53d61ac..29906b7 100644
--- a/compiler/src/Resource.hs
+++ b/compiler/src/Resource.hs
@@ -78,7 +78,7 @@ instance ToJSON GalleryItemProps where
78 78
79data GalleryItem = GalleryItem 79data GalleryItem = GalleryItem
80 { title :: String 80 { title :: String
81 , date :: ZonedTime 81 , datetime :: ZonedTime
82 , description :: String 82 , description :: String
83 , tags :: [Tag] 83 , tags :: [Tag]
84 , path :: Path 84 , path :: Path
@@ -109,7 +109,7 @@ buildGalleryTree processItem processThumbnail tagsFromDirectories galleryName in
109 fileModTime <- lastModTime path 109 fileModTime <- lastModTime path
110 return GalleryItem 110 return GalleryItem
111 { title = itemTitle 111 { title = itemTitle
112 , date = fromMaybe fileModTime $ Input.date sidecar 112 , datetime = fromMaybe fileModTime $ Input.datetime sidecar
113 , description = optMeta description "" 113 , description = optMeta description ""
114 , tags = (optMeta tags []) ++ implicitParentTags parents 114 , tags = (optMeta tags []) ++ implicitParentTags parents
115 , path = parents </ itemTitle 115 , path = parents </ itemTitle
@@ -129,7 +129,7 @@ buildGalleryTree processItem processThumbnail tagsFromDirectories galleryName in
129 dirModTime <- lastModTime path 129 dirModTime <- lastModTime path
130 return GalleryItem 130 return GalleryItem
131 { title = itemTitle 131 { title = itemTitle
132 , date = fromMaybe dirModTime $ mostRecentChildModTime processedItems 132 , datetime = fromMaybe dirModTime $ mostRecentChildModTime processedItems
133 , description = "" 133 , description = ""
134 , tags = (aggregateChildTags processedItems) ++ implicitParentTags parents 134 , tags = (aggregateChildTags processedItems) ++ implicitParentTags parents
135 , path = itemPath 135 , path = itemPath
@@ -148,10 +148,10 @@ buildGalleryTree processItem processThumbnail tagsFromDirectories galleryName in
148 148
149 mostRecentChildModTime :: [GalleryItem] -> Maybe ZonedTime 149 mostRecentChildModTime :: [GalleryItem] -> Maybe ZonedTime
150 mostRecentChildModTime = 150 mostRecentChildModTime =
151 maximumByMay comparingDates . map (date::(GalleryItem -> ZonedTime)) 151 maximumByMay comparingTime . map (datetime::(GalleryItem -> ZonedTime))
152 152
153 comparingDates :: ZonedTime -> ZonedTime -> Ordering 153 comparingTime :: ZonedTime -> ZonedTime -> Ordering
154 comparingDates l r = compare (zonedTimeToUTC l) (zonedTimeToUTC r) 154 comparingTime l r = compare (zonedTimeToUTC l) (zonedTimeToUTC r)
155 155
156 aggregateChildTags :: [GalleryItem] -> [Tag] 156 aggregateChildTags :: [GalleryItem] -> [Tag]
157 aggregateChildTags = unique . concatMap (\item -> tags (item::GalleryItem)) 157 aggregateChildTags = unique . concatMap (\item -> tags (item::GalleryItem))
diff --git a/example/Glacier 3000/_DSC5475.jpg.yaml b/example/Glacier 3000/_DSC5475.jpg.yaml
index d60efc3..3454a68 100644
--- a/example/Glacier 3000/_DSC5475.jpg.yaml
+++ b/example/Glacier 3000/_DSC5475.jpg.yaml
@@ -1,6 +1,6 @@
1title: Fog 3000 1title: Fog 3000
2 2
3date: 2019-08-10T14:38:47+01:00 3datetime: 2019-08-10T14:38:47+01:00
4 4
5description: > 5description: >
6 © Philippe NGUYEN 6 © Philippe NGUYEN
diff --git a/example/Glacier 3000/_DSC5542.jpg.yaml b/example/Glacier 3000/_DSC5542.jpg.yaml
index a67b284..d174911 100644
--- a/example/Glacier 3000/_DSC5542.jpg.yaml
+++ b/example/Glacier 3000/_DSC5542.jpg.yaml
@@ -1,6 +1,6 @@
1title: Foggy catwalk 1title: Foggy catwalk
2 2
3date: 2019-08-10T16:00:45+01:00 3datetime: 2019-08-10T16:00:45+01:00
4 4
5description: > 5description: >
6 © Philippe NGUYEN 6 © Philippe NGUYEN
diff --git a/example/_DSC8808-1.jpg.yaml b/example/_DSC8808-1.jpg.yaml
index ce334c2..b946ff7 100644
--- a/example/_DSC8808-1.jpg.yaml
+++ b/example/_DSC8808-1.jpg.yaml
@@ -1,6 +1,6 @@
1title: Book shop 1title: Book shop
2 2
3date: 2016-12-19T16:48:50+02:00 3datetime: 2016-12-19T16:48:50+02:00
4 4
5description: > 5description: >
6 © Philippe NGUYEN 6 © Philippe NGUYEN
diff --git a/ldgallery.1.md b/ldgallery.1.md
index 7163c8e..d217367 100644
--- a/ldgallery.1.md
+++ b/ldgallery.1.md
@@ -73,7 +73,7 @@ Metadata contained within item files themselves (e.g. Exif fields for pictures)
73title 73title
74: Title of the item. Defaults to the name of the file. 74: Title of the item. Defaults to the name of the file.
75 75
76date 76datetime
77: ISO 8601 zoned date and time. Defaults to the last modification time of the file. 77: ISO 8601 zoned date and time. Defaults to the last modification time of the file.
78 78
79description 79description