Show empty pages
This commit is contained in:
parent
3f1971c5bd
commit
5ec283e4d4
@ -52,6 +52,11 @@ final class FileSystem {
|
|||||||
*/
|
*/
|
||||||
private var expectedFiles: [String : String] = [:]
|
private var expectedFiles: [String : String] = [:]
|
||||||
|
|
||||||
|
/**
|
||||||
|
All pages without content which have been created
|
||||||
|
*/
|
||||||
|
private var emptyPages: Set<String> = []
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The image creation tasks.
|
The image creation tasks.
|
||||||
|
|
||||||
@ -402,6 +407,23 @@ final class FileSystem {
|
|||||||
return result.joined(separator: "/")
|
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
|
// MARK: Writing files
|
||||||
|
|
||||||
@discardableResult
|
@discardableResult
|
||||||
|
@ -19,7 +19,7 @@ final class ValidationLog {
|
|||||||
} else {
|
} else {
|
||||||
errorText = ""
|
errorText = ""
|
||||||
}
|
}
|
||||||
print("[\(type.rawValue)] \(item.reason), Source: \(item.source)\(errorText)")
|
print("[\(type.rawValue)][\(item.source)] \(item.reason)\(errorText)")
|
||||||
}
|
}
|
||||||
|
|
||||||
func add(error: ContentError) {
|
func add(error: ContentError) {
|
||||||
|
@ -49,10 +49,13 @@ struct PageGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let url = files.urlInOutputFolder(path)
|
let url = files.urlInOutputFolder(path)
|
||||||
|
if pageContent == nil {
|
||||||
|
files.isEmpty(page: path)
|
||||||
|
}
|
||||||
guard factory.page.generate(content, to: url) else {
|
guard factory.page.generate(content, to: url) else {
|
||||||
return
|
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)? {
|
private func makeContent(page: Element, language: String, path: String) -> (content: String, includesCode: Bool)? {
|
||||||
|
@ -24,6 +24,7 @@ try siteGenerator.generate(site: siteData)
|
|||||||
|
|
||||||
print("Pages generated")
|
print("Pages generated")
|
||||||
files.createImages()
|
files.createImages()
|
||||||
|
files.printEmptyPages()
|
||||||
print("Images generated")
|
print("Images generated")
|
||||||
files.copyRequiredFiles()
|
files.copyRequiredFiles()
|
||||||
print("Required files copied")
|
print("Required files copied")
|
||||||
|
Loading…
Reference in New Issue
Block a user