Partials path handling fixes
This commit is contained in:
parent
e919ded2ee
commit
6df2ee38a6
|
@ -66,3 +66,4 @@ fastlane/test_output
|
||||||
|
|
||||||
Packages/
|
Packages/
|
||||||
*.xcodeproj/
|
*.xcodeproj/
|
||||||
|
.DS_Store
|
||||||
|
|
|
@ -411,8 +411,14 @@ public class MustachePartialTag : MustacheTag {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let withoutLast = page.deletingLastFilePathComponent
|
let withoutLast = page.deletingLastFilePathComponent
|
||||||
let slash = withoutLast[withoutLast.startIndex] == "/" ? "/" : ""
|
let pageDir: String
|
||||||
let pageDir = slash + withoutLast.characters.split(separator: "/").map(String.init).joined(separator: "/")
|
if withoutLast.isEmpty { // foo.mustache
|
||||||
|
pageDir = "."
|
||||||
|
} else if withoutLast.hasSuffix("/") {
|
||||||
|
pageDir = withoutLast
|
||||||
|
} else {
|
||||||
|
pageDir = "."
|
||||||
|
}
|
||||||
let fullPath = pageDir + "/" + self.tag + "." + mustacheExtension
|
let fullPath = pageDir + "/" + self.tag + "." + mustacheExtension
|
||||||
do {
|
do {
|
||||||
let template = try getTemplateFromCache(fullPath)
|
let template = try getTemplateFromCache(fullPath)
|
||||||
|
|
Loading…
Reference in New Issue