diff options
author | pacien | 2020-02-29 16:39:55 +0100 |
---|---|---|
committer | pacien | 2020-02-29 16:39:55 +0100 |
commit | 54790c6c73d7c51ff22cf5e9722b141cdc0249df (patch) | |
tree | 0a0f428000f7ddc5797c2343641d70477c98d2bf | |
parent | 1b0dd00c31efc958e80fc6d9d78f2511b07c1238 (diff) | |
download | ldgallery-54790c6c73d7c51ff22cf5e9722b141cdc0249df.tar.gz |
compiler: add tagCategories setting to gallery.yaml
-rw-r--r-- | compiler/ldgallery.1.md | 6 | ||||
-rw-r--r-- | compiler/src/Config.hs | 8 | ||||
-rw-r--r-- | example/src/gallery.yaml | 4 | ||||
-rw-r--r-- | viewer/src/@types/gallery.d.ts | 3 |
4 files changed, 16 insertions, 5 deletions
diff --git a/compiler/ldgallery.1.md b/compiler/ldgallery.1.md index 3c52f9d..4f9935b 100644 --- a/compiler/ldgallery.1.md +++ b/compiler/ldgallery.1.md | |||
@@ -107,7 +107,7 @@ description | |||
107 | 107 | ||
108 | tags | 108 | tags |
109 | : List of tags for the item. | 109 | : List of tags for the item. |
110 | Tag groups can be defined using prefixes separated by ":" (colon). | 110 | Tag categories can be defined using prefixes separated by ":" (colon). |
111 | Tags specified in a directory metadata sidecar are applied to all items within that directory. | 111 | Tags specified in a directory metadata sidecar are applied to all items within that directory. |
112 | 112 | ||
113 | 113 | ||
@@ -139,6 +139,10 @@ excludedTags[] | |||
139 | : Glob patterns of tags to exclude from the gallery. | 139 | : Glob patterns of tags to exclude from the gallery. |
140 | Defaults to [] (none). | 140 | Defaults to [] (none). |
141 | 141 | ||
142 | tagCategories[] | ||
143 | : Top-level tag categories. | ||
144 | Defaults to [] (none). | ||
145 | |||
142 | tagsFromDirectories.fromParents | 146 | tagsFromDirectories.fromParents |
143 | : Automatically generate tags from the name of parent directories, | 147 | : Automatically generate tags from the name of parent directories, |
144 | looking up in the hierarchy as far as indicated by this parameter. | 148 | looking up in the hierarchy as far as indicated by this parameter. |
diff --git a/compiler/src/Config.hs b/compiler/src/Config.hs index 8796c3c..0ae0fa1 100644 --- a/compiler/src/Config.hs +++ b/compiler/src/Config.hs | |||
@@ -57,6 +57,7 @@ data GalleryConfig = GalleryConfig | |||
57 | , excludedFiles :: [String] | 57 | , excludedFiles :: [String] |
58 | , includedTags :: [String] | 58 | , includedTags :: [String] |
59 | , excludedTags :: [String] | 59 | , excludedTags :: [String] |
60 | , tagCategories :: [String] | ||
60 | , tagsFromDirectories :: TagsFromDirectoriesConfig | 61 | , tagsFromDirectories :: TagsFromDirectoriesConfig |
61 | , thumbnailMaxResolution :: Resolution | 62 | , thumbnailMaxResolution :: Resolution |
62 | , pictureMaxResolution :: Maybe Resolution | 63 | , pictureMaxResolution :: Maybe Resolution |
@@ -71,6 +72,7 @@ instance FromJSON GalleryConfig where | |||
71 | <*> v .:? "excludedFiles" .!= [] | 72 | <*> v .:? "excludedFiles" .!= [] |
72 | <*> v .:? "includedTags" .!= ["*"] | 73 | <*> v .:? "includedTags" .!= ["*"] |
73 | <*> v .:? "excludedTags" .!= [] | 74 | <*> v .:? "excludedTags" .!= [] |
75 | <*> v .:? "tagCategories" .!= [] | ||
74 | <*> v .:? "tagsFromDirectories" .!= (TagsFromDirectoriesConfig 0 "") | 76 | <*> v .:? "tagsFromDirectories" .!= (TagsFromDirectoriesConfig 0 "") |
75 | <*> v .:? "thumbnailMaxResolution" .!= (Resolution 400 300) | 77 | <*> v .:? "thumbnailMaxResolution" .!= (Resolution 400 300) |
76 | <*> v .:? "pictureMaxResolution" | 78 | <*> v .:? "pictureMaxResolution" |
@@ -80,9 +82,9 @@ readConfig = decodeYamlFile | |||
80 | 82 | ||
81 | 83 | ||
82 | data ViewerConfig = ViewerConfig | 84 | data ViewerConfig = ViewerConfig |
83 | { -- TODO: add viewer config keys (tag groups...) | 85 | { galleryTitle :: String |
84 | galleryTitle :: String | 86 | , tagCategories :: [String] |
85 | } deriving (Generic, ToJSON, Show) | 87 | } deriving (Generic, ToJSON, Show) |
86 | 88 | ||
87 | viewerConfig :: GalleryConfig -> ViewerConfig | 89 | viewerConfig :: GalleryConfig -> ViewerConfig |
88 | viewerConfig GalleryConfig{galleryTitle} = ViewerConfig galleryTitle | 90 | viewerConfig GalleryConfig{galleryTitle, tagCategories} = ViewerConfig galleryTitle tagCategories |
diff --git a/example/src/gallery.yaml b/example/src/gallery.yaml index dba6b39..b569910 100644 --- a/example/src/gallery.yaml +++ b/example/src/gallery.yaml | |||
@@ -14,6 +14,10 @@ includedFiles: | |||
14 | #includedTags: ["*"] | 14 | #includedTags: ["*"] |
15 | #excludedTags: [] | 15 | #excludedTags: [] |
16 | 16 | ||
17 | tagCategories: | ||
18 | - photographer | ||
19 | - location | ||
20 | |||
17 | #tagsFromDirectories: | 21 | #tagsFromDirectories: |
18 | # fromParents: 0 | 22 | # fromParents: 0 |
19 | # prefix: '' | 23 | # prefix: '' |
diff --git a/viewer/src/@types/gallery.d.ts b/viewer/src/@types/gallery.d.ts index 4fa544f..de1c0dd 100644 --- a/viewer/src/@types/gallery.d.ts +++ b/viewer/src/@types/gallery.d.ts | |||
@@ -23,7 +23,8 @@ declare namespace Gallery { | |||
23 | } | 23 | } |
24 | 24 | ||
25 | interface GalleryProperties { | 25 | interface GalleryProperties { |
26 | galleryTitle: string | 26 | galleryTitle: string, |
27 | tagCategories: RawTag[] | ||
27 | } | 28 | } |
28 | interface Index { | 29 | interface Index { |
29 | properties: GalleryProperties, | 30 | properties: GalleryProperties, |