diff --git a/WebsiteGenerator/Files/FileSystem.swift b/WebsiteGenerator/Files/FileSystem.swift index 3b94cc3..ee113e0 100644 --- a/WebsiteGenerator/Files/FileSystem.swift +++ b/WebsiteGenerator/Files/FileSystem.swift @@ -52,6 +52,11 @@ final class FileSystem { */ private var expectedFiles: [String : String] = [:] + /** + All pages without content which have been created + */ + private var emptyPages: Set = [] + /** The image creation tasks. @@ -402,6 +407,23 @@ final class FileSystem { return result.joined(separator: "/") } + // MARK: Pages + + func isEmpty(page: String) { + emptyPages.insert(page) + } + + func printEmptyPages() { + guard !emptyPages.isEmpty else { + return + } + log.add(info: "\(emptyPages.count) empty pages:", source: "FileSystem") + for page in emptyPages.sorted() { + log.add(info: "Empty page generated", source: page) + } + } + + // MARK: Writing files @discardableResult diff --git a/WebsiteGenerator/Files/ValidationLog.swift b/WebsiteGenerator/Files/ValidationLog.swift index 1f0715c..f2abf3e 100644 --- a/WebsiteGenerator/Files/ValidationLog.swift +++ b/WebsiteGenerator/Files/ValidationLog.swift @@ -19,7 +19,7 @@ final class ValidationLog { } else { errorText = "" } - print("[\(type.rawValue)] \(item.reason), Source: \(item.source)\(errorText)") + print("[\(type.rawValue)][\(item.source)] \(item.reason)\(errorText)") } func add(error: ContentError) { diff --git a/WebsiteGenerator/Generators/PageGenerator.swift b/WebsiteGenerator/Generators/PageGenerator.swift index 34aa0ec..feecc41 100644 --- a/WebsiteGenerator/Generators/PageGenerator.swift +++ b/WebsiteGenerator/Generators/PageGenerator.swift @@ -49,10 +49,13 @@ struct PageGenerator { } let url = files.urlInOutputFolder(path) + if pageContent == nil { + files.isEmpty(page: path) + } guard factory.page.generate(content, to: url) else { return } - log.add(info: "Generated \(pageContent == nil ? "empty page " : "")\(path)", source: page.path) + log.add(info: "Page generated", source: path) } private func makeContent(page: Element, language: String, path: String) -> (content: String, includesCode: Bool)? { diff --git a/WebsiteGenerator/main.swift b/WebsiteGenerator/main.swift index fea5039..328eeeb 100644 --- a/WebsiteGenerator/main.swift +++ b/WebsiteGenerator/main.swift @@ -24,6 +24,7 @@ try siteGenerator.generate(site: siteData) print("Pages generated") files.createImages() +files.printEmptyPages() print("Images generated") files.copyRequiredFiles() print("Required files copied")