From b468dcbf3343ea251703078ec89d3215116fc2f6 Mon Sep 17 00:00:00 2001 From: pacien Date: Tue, 25 Feb 2020 19:25:16 +0100 Subject: compiler: re-introduce gallery title --- compiler/ldgallery.1.md | 3 +++ compiler/src/Config.hs | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'compiler') diff --git a/compiler/ldgallery.1.md b/compiler/ldgallery.1.md index 4c9c6c8..3e20562 100644 --- a/compiler/ldgallery.1.md +++ b/compiler/ldgallery.1.md @@ -115,6 +115,9 @@ tags The gallery settings reside in a file named "gallery.yaml" located at the root of the gallery's source directory. +galleryTitle +: Title of the gallery. Defaults to "ldgallery". + includedDirectories[] : Glob patterns of directory names to include in the gallery. Defaults to ["*"] (matches all directory names). diff --git a/compiler/src/Config.hs b/compiler/src/Config.hs index 5f1806d..1bdb2b8 100644 --- a/compiler/src/Config.hs +++ b/compiler/src/Config.hs @@ -50,7 +50,8 @@ instance FromJSON TagsFromDirectoriesConfig where data GalleryConfig = GalleryConfig - { includedDirectories :: [String] + { galleryTitle :: String + , includedDirectories :: [String] , excludedDirectories :: [String] , includedFiles :: [String] , excludedFiles :: [String] @@ -61,7 +62,8 @@ data GalleryConfig = GalleryConfig instance FromJSON GalleryConfig where parseJSON = withObject "GalleryConfig" $ \v -> GalleryConfig - <$> v .:? "includedDirectories" .!= ["*"] + <$> v .:? "galleryTitle" .!= "ldgallery" + <*> v .:? "includedDirectories" .!= ["*"] <*> v .:? "excludedDirectories" .!= [] <*> v .:? "includedFiles" .!= ["*"] <*> v .:? "excludedFiles" .!= [] @@ -75,7 +77,8 @@ readConfig = decodeYamlFile data ViewerConfig = ViewerConfig { -- TODO: add viewer config keys (tag groups...) + galleryTitle :: String } deriving (Generic, ToJSON, Show) viewerConfig :: GalleryConfig -> ViewerConfig -viewerConfig _ = ViewerConfig -- TODO +viewerConfig GalleryConfig{galleryTitle} = ViewerConfig galleryTitle -- cgit v1.2.3