Unbroke partials.

This commit is contained in:
Kyle Jessup 2016-12-13 15:43:07 -05:00
parent 0ad5ee059f
commit 7f2c8dfd26
1 changed files with 2 additions and 8 deletions

View File

@ -411,14 +411,8 @@ public class MustachePartialTag : MustacheTag {
return
}
let withoutLast = page.deletingLastFilePathComponent
let pageDir: String
if withoutLast.isEmpty { // foo.mustache
pageDir = "."
} else if withoutLast.hasSuffix("/") {
pageDir = withoutLast
} else {
pageDir = "."
}
let slash = withoutLast[withoutLast.startIndex] == "/" ? "/" : ""
let pageDir = slash + withoutLast.characters.split(separator: "/").map(String.init).joined(separator: "/")
let fullPath = pageDir + "/" + self.tag + "." + mustacheExtension
do {
let template = try getTemplateFromCache(fullPath)