From 54790c6c73d7c51ff22cf5e9722b141cdc0249df Mon Sep 17 00:00:00 2001 From: pacien Date: Sat, 29 Feb 2020 16:39:55 +0100 Subject: compiler: add tagCategories setting to gallery.yaml --- compiler/ldgallery.1.md | 6 +++++- compiler/src/Config.hs | 8 +++++--- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'compiler') 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 tags : List of tags for the item. - Tag groups can be defined using prefixes separated by ":" (colon). + Tag categories can be defined using prefixes separated by ":" (colon). Tags specified in a directory metadata sidecar are applied to all items within that directory. @@ -139,6 +139,10 @@ excludedTags[] : Glob patterns of tags to exclude from the gallery. Defaults to [] (none). +tagCategories[] +: Top-level tag categories. + Defaults to [] (none). + tagsFromDirectories.fromParents : Automatically generate tags from the name of parent directories, 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 , excludedFiles :: [String] , includedTags :: [String] , excludedTags :: [String] + , tagCategories :: [String] , tagsFromDirectories :: TagsFromDirectoriesConfig , thumbnailMaxResolution :: Resolution , pictureMaxResolution :: Maybe Resolution @@ -71,6 +72,7 @@ instance FromJSON GalleryConfig where <*> v .:? "excludedFiles" .!= [] <*> v .:? "includedTags" .!= ["*"] <*> v .:? "excludedTags" .!= [] + <*> v .:? "tagCategories" .!= [] <*> v .:? "tagsFromDirectories" .!= (TagsFromDirectoriesConfig 0 "") <*> v .:? "thumbnailMaxResolution" .!= (Resolution 400 300) <*> v .:? "pictureMaxResolution" @@ -80,9 +82,9 @@ readConfig = decodeYamlFile data ViewerConfig = ViewerConfig - { -- TODO: add viewer config keys (tag groups...) - galleryTitle :: String + { galleryTitle :: String + , tagCategories :: [String] } deriving (Generic, ToJSON, Show) viewerConfig :: GalleryConfig -> ViewerConfig -viewerConfig GalleryConfig{galleryTitle} = ViewerConfig galleryTitle +viewerConfig GalleryConfig{galleryTitle, tagCategories} = ViewerConfig galleryTitle tagCategories -- cgit v1.2.3