From e8513a896b35d0b47b7963a7ec0d14685aca1974 Mon Sep 17 00:00:00 2001 From: Christoph Hagen Date: Fri, 9 Sep 2022 10:59:26 +0200 Subject: [PATCH] Add option to generate empty md files --- WebsiteGenerator/Files/Configuration.swift | 39 ++++++++++++++++++++++ config_example.json | 1 + 2 files changed, 40 insertions(+) diff --git a/WebsiteGenerator/Files/Configuration.swift b/WebsiteGenerator/Files/Configuration.swift index e4e99ff..73214eb 100644 --- a/WebsiteGenerator/Files/Configuration.swift +++ b/WebsiteGenerator/Files/Configuration.swift @@ -1,15 +1,54 @@ import Foundation +/** + The global configuration of the website. + */ struct Configuration: Codable { + /** + The width of page content in pixels. + + The width specification is used to scale images to the correct width, + when images are included in markdown content using the syntax + `![](image.jpg)`. + - Note: A high-resolution `@2x` version will be generated as well. + */ let pageImageWidth: Int + /** + Automatically minify all `.css` and `.js` resources which are copied + to the output folder. + - Note: This option requires the `uglifyjs` and `clean-css` tools, + which can be installed using the `install.sh` script in the root folder of the generator. + */ let minifyCSSandJS: Bool + /** + The path to the directory where the root element metadata is located. + */ let contentPath: String + /** + The path where the generated website should be written. + */ let outputPath: String + /** + Create .md files for content pages, if they don't exist. + + After the languages of the root element are read, the generator looks + for localized `.md` files for each page element which has metadata. + If it can't find a content file, it generates a placeholder. + + Setting this option to `true` will cause the generator to create empty `.md` + files for each root level language. This can be helpful to see which content still needs + to be written. There is then also no need to manually create these files. + + - Note: Empty content files will continue to be ignored by the generator, + and treated as if they are not present. + */ + let createMdFilesIfMissing: Bool + var contentDirectory: URL { .init(fileURLWithPath: contentPath) } diff --git a/config_example.json b/config_example.json index 8ed1ca1..96417b0 100644 --- a/config_example.json +++ b/config_example.json @@ -1,6 +1,7 @@ { "pageImageWidth" : 748, "minifyCSSandJS" : true, + "createMdFilesIfMissing" : false, "contentPath" : "/path/to/content/folder", "outputPath" : "/path/to/output/folder") }