Comments
This commit is contained in:
@@ -1,17 +1,23 @@
|
||||
|
||||
/// Class holding Mustache template
|
||||
public class HBMustacheTemplate {
|
||||
/// Initialize template
|
||||
/// - Parameter string: Template text
|
||||
/// - Throws: HBMustacheTemplate.Error
|
||||
public init(string: String) throws {
|
||||
self.tokens = try Self.parse(string)
|
||||
}
|
||||
|
||||
internal init(_ tokens: [Token]) {
|
||||
self.tokens = tokens
|
||||
}
|
||||
|
||||
/// Render object using this template
|
||||
/// - Parameter object: Object to render
|
||||
/// - Returns: Rendered text
|
||||
public func render(_ object: Any) -> String {
|
||||
self.render(object, context: nil)
|
||||
}
|
||||
|
||||
internal init(_ tokens: [Token]) {
|
||||
self.tokens = tokens
|
||||
}
|
||||
|
||||
internal func setLibrary(_ library: HBMustacheLibrary) {
|
||||
self.library = library
|
||||
for token in tokens {
|
||||
|
||||
Reference in New Issue
Block a user