Stop printing so much stuff

This commit is contained in:
Sami Samhuri 2019-12-04 17:18:20 -08:00
parent b00a48b096
commit 57de420eee
3 changed files with 8 additions and 3 deletions

View file

@ -30,7 +30,7 @@ final class SiteTemplateRenderer: TemplateRenderer {
func renderTemplate(name: String?, context: [String: Any]) throws -> String {
let siteContext = SiteContext(site: site, template: name)
let contextDict = siteContext.dictionary.merging(context, uniquingKeysWith: { _, new in new })
print("Rendering \(siteContext.template) with context \(contextDict)")
print("Rendering \(siteContext.template) with context keys: \(contextDict.keys.sorted().joined(separator: ", "))")
return try stencil.renderTemplate(name: "\(siteContext.template).html", context: contextDict)
}
}

View file

@ -72,3 +72,9 @@ extension Post {
assert(path == handWrittenPath, "FUCK: Generated path (\(path)) doesn't match the hand-written one \(handWrittenPath)")
}
}
extension Post: CustomDebugStringConvertible {
var debugDescription: String {
"<Post slug=\(slug) title=\"\(title)\" date=\"\(formattedDate)\" link=\(link?.absoluteString ?? "no")>"
}
}

View file

@ -114,7 +114,7 @@ final class PostsPlugin: Plugin {
}
private func renderPost(_ post: Post, monthDir: URL, templateRenderer: TemplateRenderer) throws {
print("renderPost(\(post), monthDir: \(monthDir), templateRenderer: \(templateRenderer)")
print("renderPost(\(post.debugDescription), monthDir: \(monthDir), templateRenderer: \(templateRenderer)")
try fileManager.createDirectory(at: monthDir, withIntermediateDirectories: true, attributes: nil)
let filename = "\(post.slug).html"
let postURL = monthDir.appendingPathComponent(filename)
@ -130,7 +130,6 @@ final class PostsPlugin: Plugin {
}
private func enumerateMarkdownFiles(directory: URL) throws -> [URL] {
print("enumerateMarkdownFiles(directory: \(directory))")
return try fileManager.contentsOfDirectory(atPath: directory.path).flatMap { (filename: String) -> [URL] in
let fileURL = directory.appendingPathComponent(filename)
var isDir: ObjCBool = false