Print draft pages
This commit is contained in:
parent
1537aaab01
commit
4dc56e5dfe
@ -57,6 +57,11 @@ final class FileSystem {
|
|||||||
*/
|
*/
|
||||||
private var emptyPages: Set<String> = []
|
private var emptyPages: Set<String> = []
|
||||||
|
|
||||||
|
/**
|
||||||
|
All pages which have `status` set to ``PageState.draft``
|
||||||
|
*/
|
||||||
|
private var draftPages: Set<String> = []
|
||||||
|
|
||||||
/**
|
/**
|
||||||
All paths to page element folders, indexed by their unique id.
|
All paths to page element folders, indexed by their unique id.
|
||||||
|
|
||||||
@ -427,9 +432,23 @@ final class FileSystem {
|
|||||||
guard !emptyPages.isEmpty else {
|
guard !emptyPages.isEmpty else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.add(info: "\(emptyPages.count) empty pages:", source: "Files")
|
print("\(emptyPages.count) empty pages:")
|
||||||
for page in emptyPages.sorted() {
|
for page in emptyPages.sorted() {
|
||||||
log.add(info: "\(page) has no content", source: "Files")
|
print(" " + page)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func isDraft(path: String) {
|
||||||
|
draftPages.insert(path)
|
||||||
|
}
|
||||||
|
|
||||||
|
func printDraftPages() {
|
||||||
|
guard !draftPages.isEmpty else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
print("\(draftPages.count) drafts:")
|
||||||
|
for page in draftPages.sorted() {
|
||||||
|
print(" " + page)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,9 @@ struct PageGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let url = files.urlInOutputFolder(path)
|
let url = files.urlInOutputFolder(path)
|
||||||
if pageContent == nil {
|
if page.state == .draft {
|
||||||
|
files.isDraft(path: page.path)
|
||||||
|
} else if pageContent == nil, page.state != .hidden {
|
||||||
files.isEmpty(page: path)
|
files.isEmpty(page: path)
|
||||||
}
|
}
|
||||||
guard factory.page.generate(content, to: url) else {
|
guard factory.page.generate(content, to: url) else {
|
||||||
|
@ -22,9 +22,10 @@ do {
|
|||||||
private let siteGenerator = try SiteGenerator()
|
private let siteGenerator = try SiteGenerator()
|
||||||
try siteGenerator.generate(site: siteData)
|
try siteGenerator.generate(site: siteData)
|
||||||
|
|
||||||
print("Pages generated")
|
print("Pages generated\n")
|
||||||
files.createImages()
|
files.createImages()
|
||||||
files.printEmptyPages()
|
files.printEmptyPages()
|
||||||
|
files.printDraftPages()
|
||||||
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