Add a Template Loader

This commit is contained in:
Kyle Fuller
2014-12-28 23:32:13 +00:00
parent 2374786963
commit 1989c20932
8 changed files with 178 additions and 4 deletions

View File

@@ -1,4 +1,5 @@
import Foundation
import PathKit
/// A class representing a template
public class Template {
@@ -34,6 +35,18 @@ public class Template {
}
}
/// Create a template with a file found at the given path
public convenience init?(path:Path) {
var error:NSError?
if let string:String = path.read() {
self.init(templateString:string)
} else {
self.init(templateString:"")
return nil
}
}
/// Create a template with a template string
public init(templateString:String) {
let lexer = Lexer(templateString: templateString)