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 ++++++--- example/src/gallery.yaml | 2 ++ viewer/src/@types/gallery.d.ts | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) 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 diff --git a/example/src/gallery.yaml b/example/src/gallery.yaml index b25b657..d2f90aa 100644 --- a/example/src/gallery.yaml +++ b/example/src/gallery.yaml @@ -1,5 +1,7 @@ # ldgallery example gallery configuration file +#galleryTitle: "ldgallery" + #includedDirectories: ["*"] #excludedDirectories: [] diff --git a/viewer/src/@types/gallery.d.ts b/viewer/src/@types/gallery.d.ts index 399fb66..4fa544f 100644 --- a/viewer/src/@types/gallery.d.ts +++ b/viewer/src/@types/gallery.d.ts @@ -23,7 +23,7 @@ declare namespace Gallery { } interface GalleryProperties { - // empty for now + galleryTitle: string } interface Index { properties: GalleryProperties, -- cgit v1.2.3