mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-03-25 09:05:47 +00:00
Stop printing so much stuff
This commit is contained in:
parent
b00a48b096
commit
57de420eee
3 changed files with 8 additions and 3 deletions
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")>"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue